10 Replies Latest reply on Apr 18, 2013 2:42 AM by matheisl.florian

    OnPreComponentPlace Event wont work with VB.NET

    matheisl.florian

      Hello Community,


      I tried two ways to get the Event OnPreComponentPlace from Expedition, but it doesn´t seem to work in VB.NET (VBS and TCL worked).

      The Function appdoc_OnPreComponentPlace wont get triggered from the Event

      First one, WithEvents and Handle to Function:

       

      Public WithEvents appdoc As MGCPCB.Document

       

           ' Test with "WithEvents"

           Public Function appdoc_OnPreComponentPlace2(ByVal comp As Object, ByVal x As Double, ByVal y As Double, ByVal layer As Integer, ByVal rot As Double, ByVal mirr As Boolean) As Boolean Handles appdoc.OnPreComponentPlace

           Debug.WriteLine("appdoc_OnPreComponentPlace2")

           End Function

       

      Second one, with AddHandler

       

           Sub New()

                appdoc = UserStandardLib.GetActiveDoc()

                AddHandler appdoc.OnPreComponentPlace, AddressOf appdoc_OnPreComponentPlace

           End Sub

       

       

           'Test with "AddHandler"

          Public Function appdoc_OnPreComponentPlace(comp As MGCPCB.IMGCPCBComponent, x As Double, y As Double, layer As Integer, rot As Double, mirr As Boolean) As Boolean

              Debug.WriteLine("appdoc_OnPreComponentPlace")

               Return True

          End Function

       

       

       

      This Event works with AddHandler and WithEvents:


      Private Sub appdoc_OnNotitfy(notify As MGCPCB.EPcbOnNotifyType)

              Debug.WriteLine("OnNotify: " & notify.ToString)

          End Sub

       

       

       

       

       

      Perhaps anyone can help to find the problem or the failure of my lines


      Thanks,


      Florian