Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where to put Sub functions?
Message
De
22/10/2003 18:06:55
 
 
À
22/10/2003 18:00:27
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00841315
Message ID:
00841345
Vues:
24
>>I think everything in .Net has to be in a class.
>
>Ok
>
>>Create a WebCommon class with your method in it. Make the method static and you can call it from both aspx pages.
>
>I'm new to this. What would be the step in order to make this new class static.

I'm a C#'er so not 100% sure of the VB syntax. But, the fact of the method being static isn't what makes it callable from both pages, I guess I kinda misstated that. Making it static allows you to call it without instanciating the class. So, in your code you can just do...

MyResult = WebCommon.MyStaticMethod(Whatever)

without having to createobj, or whatever you do to instanciate in VB.Net.

If the webcommon class is in the same project and the same namespace as your aspx pages it should be callable. If you want to put your webcommon in another project you would have to add a reference to that project from your webpage's project to use it.

BOb
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform