Jen,
Modules in VB.Net are just a nice/simple way to do something else: create a
utility class. When you do:
Module Foo
public function DoSomething() as string
...
end function
end Module
it actually gets compiled as a class:
CLASS Foo
PRIVATE SUB NEW
END SUB
public SHARED function DoSomething() as string
...
end function
end CLASS
I've capitalized the difference between the two. It might even mark the
class as NotInheritable (I'm not sure, though it should), but that's really
beyond the point. What I'm trying to say is that a module is a
class...atleast a static/shared class. If you prefer to use one syntax over
another, I see little harm in that (though it might confuse C#/Java
programmers). The difference between the type of class a Module creates (a
static/shared class) and a normal "instance" class is that you never create
an instance of a module.
You would never do:
Dim myFoo as Foo = new Foo()
actually, you can't do this....you would only use it for utility purposes:
dim someValue as string = Foo.DoSomething()
whereas a normal class you create an instance:
dim user as User = new User()
user.UserId = 1
user.UserName = "asdas"
.....
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Jen" <an*******@discussions.microsoft.com> wrote in message
news:16****************************@phx.gbl...
Well, I guess a little more background than that. Why
would you choose to use them? How they are integrated?
Differences between modules? etc...-----Original Message-----
Here's a custom class:
public class foo
{
public foo()
{
}
}
What else do you need to know?
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
"Jen" <an*******@discussions.microsoft.com> wrote in
messagenews:05****************************@phx.gbl...I am fairly new to .NET and was wondering if someone
could point me to a tutorial/overview of writing custom
classes? Thank you.
.