Imports System.Runtime.InteropServices
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim application As DesignManager.Application = Nothing
Dim strFilePath As String = "C:\SIEM00000008_B.par"
Dim objDesMgrDoc As DesignManager.Document = Nothing
Dim strFindDupFileNameList(0) As Object
Dim objType As Type = Nothing
Try
' Below code will test Design Manager automation
Try
application = Marshal.GetActiveObject("DesignManager.Application")
Catch ex As Exception
' Get the type from the Solid Edge ProgID
objType = Type.GetTypeFromProgID("DesignManager.Application")
' Start Solid Edge
application = Activator.CreateInstance(objType)
Finally
' Make Solid Edge visible
application.Visible = True
End Try
strFindDupFileNameList(0) = "C:\SIEM00000008_B.par"
objDesMgrDoc = application.OpenFileInDesignManager(strFilePath)
application.WhereUsedCriteria(Nothing, True) = "C:\"
objDesMgrDoc.ExpandAll(False)
application.PerformWhereUsedinGrid(strFindDupFileNameList)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
public class Form1
{
private void Button1_Click(object sender, EventArgs e)
{
DesignManager.Application application = null;
string strFilePath = "C:\\SIEM00000008_B.par";
DesignManager.Document objDesMgrDoc = null;
object[] strFindDupFileNameList = new object[1];
Type objType = null;
try
{
// Below code will test Design Manager automation
try
{
application = (DesignManager.Application)Marshal.GetActiveObject("DesignManager.Application");
}
catch (Exception ex)
{
// Get the type from the Solid Edge ProgID
objType = Type.GetTypeFromProgID("DesignManager.Application");
// Start Solid Edge
application = Activator.CreateInstance(objType);
}
finally
{
// Make Solid Edge visible
application.Visible = true;
}
strFindDupFileNameList[0] = "C:\\SIEM00000008_B.par";
objDesMgrDoc = application.OpenFileInDesignManager(strFilePath);
application.WhereUsedCriteria(null, true) = "C:\\";
objDesMgrDoc.ExpandAll(false);
application.PerformWhereUsedinGrid(strFindDupFileNameList);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}