Loading Form with PDM Event

HI,

I'm trying to load a form when checkout a file from vault.

And I tested with sample code as shown as below.

<p>Imports EdmLib</p><p></p><p></p><p>Public Class Class1</p><p></p><p></p><p>Implements IEdmAddIn5</p><p></p><p></p><p>Public name As String</p><p></p><p></p><p>Public Sub GetAddInInfo(ByRef poInfo As EdmAddInInfo, poVault As IEdmVault5, poCmdMgr As IEdmCmdMgr5) Implements IEdmAddIn5.GetAddInInfo</p><p></p><p></p><p></p><p></p><p>'Specify add-in information</p><p>poInfo.mbsAddInName = "My first add-in"</p><p>poInfo.mbsCompany = "The name of my company"</p><p></p><p></p><p>poInfo.mbsDescription = "This is a very nice add-in."</p><p>poInfo.mlAddInVersion = 1</p><p></p><p></p><p>'Specify minimum version of SOLIDWORKS Enterprise PDM</p><p>poInfo.mlRequiredVersionMajor = 5</p><p>poInfo.mlRequiredVersionMinor = 2</p><p></p><p></p><p>'Notify when a file has been added</p><p>poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostAdd)</p><p></p><p></p><p>'Notify when a file has been checked out</p><p>poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostLock)</p><p></p><p></p><p>'Notify when a file is about to be checked in</p><p>poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreUnlock)</p><p></p><p></p><p>'Notify when a file has been checked in</p><p>poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostUnlock)</p><p></p><p></p><p>End Sub</p><p></p><p></p><p>Public Sub OnCmd(ByRef poCmd As EdmCmd, ByRef ppoData As Array) Implements IEdmAddIn5.OnCmd</p><p></p><p></p><p>'Check the type of hook that triggered this call</p><p></p><p></p><p>Select Case poCmd.meCmdType</p><p>Case EdmCmdType.EdmCmd_PostAdd</p><p>name = "PostAdd"</p><p>Case EdmCmdType.EdmCmd_PostLock</p><p>name = "PostLock"</p><p></p><p></p><p></p><p></p><p>'Initiate the Form Here</p><p></p><p></p><p>Dim myform As New Form1</p><p>myform.ShowDialog()</p><p></p><p></p><p>Case EdmCmdType.EdmCmd_PreUnlock</p><p>name = "PreUnlock"</p><p>Case EdmCmdType.EdmCmd_PostUnlock</p><p>name = "PostUnlock"</p><p>Case Else</p><p>name = "?"</p><p>End Select</p><p></p><p></p><p></p><p></p><p>'Check the upper and lower bounds of the array</p><p>Dim message As String</p><p>message = ""</p><p>Dim index As Long</p><p>index = LBound(ppoData)</p><p>Dim last As Long</p><p>last = UBound(ppoData)</p><p></p><p></p><p></p><p></p><p>'Append the paths of all files to a string</p><p>While index <= last</p><p>message = message + ppoData(index).mbsStrData1 + vbLf</p><p>index = index + 1</p><p>End While</p><p></p><p></p><p>'Display a message to the user</p><p>'message = "The following files were affected by a " + name + " hook:" + vbLf + message</p><p></p><p></p><p>Dim vault As EdmVault5</p><p>vault = poCmd.mpoVault</p><p>vault.MsgBox(poCmd.mlParentWnd, message)</p><p></p><p></p><p>End Sub</p><p>End Class</p>

And I want to load the below form to get output value. In the text box I want to show up the results ("name").

Form Codes :

<p>Public Class Form1</p><p></p><p></p><p>Dim callClass As New Class1</p><p></p><p></p><p>Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click</p><p>Me.Close()</p><p>End Sub</p><p></p><p></p><p>Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load</p><p></p><p></p><p>End Sub</p><p></p><p></p><p>Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click</p><p>TextBox1.Text = callClass.name</p><p>End Sub</p><p>End Class</p>

its loading a form successfully. But once I click the button "Get Value" Nothing I get.

Could you please anyone help with this issue?.

Thanks a lot

SolidworksApi/macros