Determine when Visual Studio has entered design mode VB.NET -


i trying create add-in in visual studio 2012 perform operations after program has been executed. requires me know when design mode has been entered. have code below works in c#, , working in vb.net.

    public void onconnection(object application, ext_connectmode connectmode, object addininst, ref array custom)     {         .         .         .         //initialize event handlers host         _debuggerevents = _applicationobject.events.debuggerevents;         _debuggerevents.onenterdesignmode += new _dispdebuggerevents_onenterdesignmodeeventhandler(onenterdesignmode);     }      /// <summary>handles when host application object's debugger enters design mode (is done debugging).</summary>     /// <param name="reason">the reason host application object entering design mode.</param>     public static void onenterdesignmode(dbgeventreason reason)     {         system.windows.forms.messagebox.show("add-in debug: debugger enters design mode.");     } 

i tried converting vb equivalent resulted in

public sub onconnection(byval application object, byval connectmode ext_connectmode, byval addininst object, byref custom array) implements idtextensibility2.onconnection     .     .     .     ' initialize event handlers host     _debuggerevents = _hostappobj.events.debuggerevents     _debuggerevents.onenterdesignmode += new _dispdebuggerevents_onenterdesignmodeeventhandler(addressof _debuggerevents.onenterdesignmode) end sub  public sub onenterdesignmode(byval reason dbgeventreason)     system.windows.forms.messagebox.show("add-in debug: debugger enters design mode.") end sub 

visual studio has marked both occurrences of "_debuggerevents.onenterdesignmode" note "late bound resolution; runtime errors occur." don't see runtime errors, never see message box pop notification design mode has been entered c# version does. tips?

thanks.

use addhandler statement add event handler (this 1 of ways how done in vb.net).

in case, be:

public sub onconnection(byval application object, byval connectmode ext_connectmode, byval addininst object, byref custom array) implements idtextensibility2.onconnection     ' initialize event handlers host     _debuggerevents = _hostappobj.events.debuggerevents     addhandler _debuggerevents.onenterdesignmode, addressof onenterdesignmode end sub  public sub onenterdesignmode(byval reason dbgeventreason)     system.windows.forms.messagebox.show("add-in debug: debugger enters design mode.") end sub 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -