Sdílet prostřednictvím


Adding to the My namespace in VB .NET

Just as an aside - after experimenting with the Interop Forms Toolkit earlier this year I wondered how InteropToolbox ended up in the My namespace – it seems like a useful thing to be able to do. I didn’t have to look far, the answer was in the ActiveXControlHelpers.vb file in my Usercontrol project:

    1:  'Adds the InteropToolbox to the My namespace
    2:  Namespace My
    3:      'The HideModuleNameAttribute hides the module name MyInteropToolbox so the syntax becomes My.InteropToolbox.   
    4:      <Global.Microsoft.VisualBasic.HideModuleName()> _
    5:      Module MyInteropToolbox
    6:   
    7:          Private _toolbox As New InteropToolbox
    8:   
    9:          Public ReadOnly Property InteropToolbox() As InteropToolbox
   10:              Get
   11:                  Return _toolbox
   12:              End Get
   13:          End Property
   14:      End Module
   15:  End Namespace

You might want to have a look at this as well.

Comments

  • Anonymous
    June 08, 2009
    I have been sitting on a long list of part finished posts on Visual Basic “stuff” intended for my other