|
-
Feb 11th, 2009, 11:53 AM
#1
Thread Starter
Fanatic Member
Library of Functions in a Shared Class?
I have large group of functions that I would like to store in basically a library and simply call the functions from the controls on my forms. Back in VB 6 I would have done this with a module, but now I have been told that a Public Class is the correct way in .NET. How should I go about doing this? Any sample code of setting up a public class would be appreciated as I am new to this. Thanks in advance.
-Jeremy
-
Feb 11th, 2009, 12:00 PM
#2
Re: Library of Functions in a Shared Class?
The Module keyword still exists in VB.Net and behind the scenes it creates a public shared class so you are probably as well off to just use a module.
-
Feb 11th, 2009, 12:03 PM
#3
Re: Library of Functions in a Shared Class?
there's nothing wrong with a module in .NET... it's jsut simply a type of shared class... nothing more, nothing less. So, you can do this one of two ways. 1) Use the module. Then you can reference the functions directly, jsut as you would (DoMyFunction())... be sure to make the subs either public or friend based on your needs. 2) Add a class, then markup all your subs with Shared ... when you then access them you'll have to qualify it with the class name (myClass.DoMyFunction())
both amount to the same thing in the end.
-tg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|