Hiding references to forms in a VB.NET DLL

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

I have a DLL that has a couple of class objects, and a few forms. When
someone uses my DLL (i.e. puts a reference to it in their program), I want
them to see the class objects that are public, but I -DON'T- want them to
see the forms (via intellisense). They should only be able to access the
forms by calling routines in the class libraries which then display the
forms.

What do I need to do to get this to occur? Declare each forms class as
Friend? Or what?

Tom
 
I think you can use an attribute to do such a thing

check out

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemCompone
ntModelBrowsableAttributeClassTopic.htm

In which case you can set

<BrowseableAttribute(False)>My FormClass
inherits System.windows.forms.form

And that *should* hide it from intellisense...

-CJ
 
Nevermind, reading futher I don't know if thats possible.. I would assume an
Attribute could do so, or you could define your own attribute, but I haven't
played with designer stuff like that much...

Delcaring the method private or the class private (or protected with
CannotInherit property) will prevent anyone from ever using it.
 
Hello,

Tom said:
I have a DLL that has a couple of class objects, and a
few forms. When someone uses my DLL (i.e. puts a
reference to it in their program), I want them to see the
class objects that are public, but I -DON'T- want them to
see the forms (via intellisense). They should only be able
to access the forms by calling routines in the class libraries
which then display the forms.

Don't set the modifier of the forms to 'Public'.
 
Tom,
As the others have suggested. Set the forms to Friend.

Friend Class Form1
Inherits ...Form
End Class

Will cause Form1 to only be accessible from within that assembly.

Hope this helps
Jay
 
Back
Top