Re: Global Functions in 2.0?
put it in a module and make the method public, or put it in a class and make the method shared. That will give you access to it from anywhere in the application.
Re: Global Functions in 2.0?
Quote:
Originally Posted by kleinma
put it in a module and make the method public, or put it in a class and make the method shared. That will give you access to it from anywhere in the application.
umm..I don't see the ability to add a module to a web app?
A class won't work here for I am using the Membership Collection...
Re: Global Functions in 2.0?
Just add a class .vb file to your web app and change the word Class to Module in the code
VB Code:
Public Module MyMod
Public Function Test() as string
return "This Is A Test"
End Function
End Module
Then in your aspx code behind page for any given page, you can simply call MyMod.Test and it will return that string.
As for what you said about using the membership collection. I don't know what that has to do with you using or not using a module/class. Infact a module simply is a class, where everything is automatically shared. Do you mean because you need some value that is on the ASPX page at runtime? If so you can simply pass it to your function in your module/class and process it.