Class II

  • Thread starter Thread starter André Almeida Maldonado
  • Start date Start date
A

André Almeida Maldonado

When I create a class, to where it goes???
Exists a file that represents it??
How can I use my class in my aspx page or UserControl, it's just import the
class??
Someone have an example???

Thank's a lot
 
André Almeida Maldonado said:
When I create a class, to where it goes???
Exists a file that represents it??

You can put one or several classes in one file. You can also create nested
classes.
How can I use my class in my aspx page or UserControl, it's just
import the class??

Someone have an example???


I don't know ASP, but in order to create an object use the "New" keyword:

dim o as TheClass

o = New TheClass

If the class name can not be resolved because it is neither part of the
current class or namespace, nor part of the enclosing namespaces, nor a part
of the imported namespaces/classes, you have to specify the full qualified
name:

dim o as NamespaceLevel1.NamespaceLevel2.TheClass

o = New NamespaceLevel1.NamespaceLevel2.TheClass


You can also put the class in a class library. To use the class in a second
library or application, add a reference to the library within the second
application.
 
Speaking from Visual Basic when you create a class and want to use it an
application you must declare something of type [class_name]

For example say I made a database class called myDBClass

Dim myDatabase as myDBClass

This would create the object myDatabase of type myDBClass within my
application. Is that what you were looking for?

-Ivan
 
Armin Zingler said:
If the class name can not be resolved because it is neither part of
the current class or namespace, nor part of the enclosing namespaces,
nor a part of the imported namespaces/classes, you have to specify
the full qualified name:

This was the short explanation. The longer one is contained in chapter 4.7.1
of the VB.NET language specifications.

The web version is split to 4.7.1 and 4.7.2:
http://msdn.microsoft.com/library/en-us/vbls7/html/vblrfVBSpec4_7.asp
 
Back
Top