How to modify VB6.0 code to VB.NET

Hello everyone! How to modify the following code into a VB.NET program?

Private Function ms_MouseSelectNotify(ByVal ix As Long, ByVal iy As Long, ByVal X As Double, ByVal Y As Double, ByVal Z As Double) As Long
End
End Function

SolidworksApi/macros
Answers 4
ZA
ZA 2021-03-26 Best Answer

Eddy Alleman, thank you, the problem is solved

EA
EA 2021-03-26

Hi Zheng As,

End can also be used in VB.NET:

End statement docs

Eddy

ZA
ZA 2021-03-26

Thank you, Fifi Riri, I mean how to modify the End in the function to the program corresponding to VB.NET

FR
FR 2021-03-26

Hello. Try:

Sub AttachEventHandlers()
AttachSWEvents()
End Sub

Sub AttachSWEvents()
AddHandler msMouse.MouseSelectNotify, AddressOf Me.ms_MouseSelectNotify
AddHandler msMouse.MouseLBtnDownNotify, AddressOf Me.ms_MouseLBtnDownNotify
End Sub

Private Function ms_MouseSelectNotify(ByVal Ix As Integer, ByVal Iy As Integer, ByVal x As Double, ByVal y As Double, ByVal z As Double) As Integer

End Function

See exemple: 2015 SOLIDWORKS API Help - Run SOLIDWORKS Commands and Synthesize Mouse Events Example (VB.NET)