Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

global functions

Status
Not open for further replies.

kaijanm

Programmer
May 14, 2003
102
US
This seems like a really stupid question, but I can't seem to get this figured out. I have several functions that need to be called from multiple pages and I'd like to put them somewhere that I can call them from where ever. I tried putting them in global.asax (seems logical to me, at least), but other pages don't seem to know what the function is.

Any ideas? I can't seem to find anything similar in my books.

Thanks!
Kimberly
 
Create a class file (ex. myFunctions)and put all your general functions into that. On the page that you need the function instantiate the class and call the function.

myFunctions Kazaam = new myFunctions();

Kazaam.Yourfunctionnamehere();

That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
The other thing you could do is put them in a module file and declare the functions public.

That way you don't need to create a class to access them, you just call them directly

i.e.

Module MyPublicFunction

Public Sub YourFunctionNameHere()

End Sub

End Module

'''in your code'''
YourFunctionNameHere()

D'Arcy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top