Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inclusion of .vb file in another one
Message
De
18/04/2006 13:06:07
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
 
 
À
18/04/2006 12:35:24
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01114310
Message ID:
01114328
Vues:
11
>Is there a way to include a .vb file in another one? Basically, lets say I have App.vb, Encrypt.vb and Internet.vb. App.vb is the Framework. Other classes defined in Encrypt.vb and Internet.vb should be under App.vb file. So, basically, I would like to be able to do something like Framework.Encrypt.MyClass(). However, the only reason why I didn't include Encrypt.vb and Internet.vb as nested class in App.vb is because of the size of the App.vb that this would generate. I have over 40 .vb files. If I include them all as nested class in App.vb, I will end up with 400k in just App.vb which wouldn't make any sense as part as project design and code maintenance. So, by preserving them as individual files, how can I have them defined as nested class in App.vb? I thought there could be ways of implementing this.
>
>The only approach I have found so far is to include each of them in App.vb as nested classes but only with the properties and method definitions and not the method content. Thus, each of those method acts as a wrapper method, making them available as nested classes under App.vb, which are then calling the class directlly like Encrypt.MyClass() by passing the Framework.App object as a parameter so each of those .vb files could have a reference to the application object.

Michel,

Individual files do not make a difference as long as they are within the same project (and will end up in the same dll). The Namespace is what 'binds' them together. At the top of each file, put a namespace declaration:
' Framework.vb

Namespace Framework

Public Class App
...
End Class

End Namespace

' Encrypt.vb

Namespace Framework

Public Class Encrypt
End Class

End Namespace
Now, the references to both classes start with Framework.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform