-
Modules?
Hey there all,
I am writing a forum in asp.net, its coming along great, but I thinkI may be making the job harder than it should be.
Heres my question:
I am using VisualBasic ASP.net and well I need have several routines which will be exectly the same for each page, such as 'Private message check' and such like. In vb6 and .net you are able to have modules, I'm not writing the forum as an application, but as plain aspx files.
is is possible to have a page or module, that stores all the routines that I will need, and be able to call them from the file when required?
If so how do I do this?
Thanks,
-
Right-click your project, Click Add New Class...
Anywhere you need it, instantiate it with a new operator, and use its methods.
And forget the term Modules... Modules are just classes (so are WebForms), but they are named Modules so VB6 people could assimilate.
-
Modules are classes, but they are special classes. Everything in them is shared (you don't have to create an instance of the class in order to use the properties/methods). This is a big difference compared to a normal class because you have to create an instance in order to use it.
It is basically like you are using the 'shared' keyword when declaring things, but without having to actually do it. In C#, the keyword is 'static' that marks the properties/methods as shared accross all instances.
-
Oh ok... thanks for the clarification. I don't ever use Modules so I really wouldn't know. :)
-
ok, thanks for the replies, but I'm not creating the site in V.Studio I using WebMatrix (unfortunatly) as I was told that using V.Studio , ment I required a different host, and there would more coding to do something in V.Studio compaired to webmatrix?
so can I still do it use webmatrix?
thanks again