What happened to Modules in VB.NET 2005 Web development
I am trying to transfer my web site developed with VB.NET 2003 and ASP.NET 1.1 to VB.NET 2005 and ASP.NET 2.0
I have quite a lot of functions that I reuse throughout the different pages, so I have put them in a module. But when I transfer the site to ASP.NET 2.0 it no longer recognizes modules. Is there another easy way to make public functions and subs?
Thanks.
JJRDK
[391 byte] By [
jjrdk] at [2007-12-16]
A great way to write shared/reusable code in general is to created a public class and place it in the App_Code folder.
For example
Defining central code:
1) Add New Item -> Class
2) name it "Helpers" -> OK
| |
Imports Microsoft.VisualBasicPublic Class Helpers Public Sub InstanceMethod() End Sub Public Sub SharedMethod() End Sub End Class
|
Using code
| |
'call instance methodDim h as New Helpers h.InstanceMethod 'call shared method (there is no need to Dim a variable) Helpers.SharedMethod |
This should do the trick for you in general.
Best,
Paul Yuknewicz
Visual Basic