No Class at ALL!!! beginner/beginner question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to define a class to use as what i would call a datastructure
my sinple example does not work and i know the answer will be a 2 seconder.
here is my code the instance of c is flagged as undefined.

Public Class crt
Dim col As Integer
End Class
Public Class IndexBuilderDaily2
Inherits System.Web.UI.Page
Dim c As crt
c.col = 1 ' <--- compiler says declaration expected
Hey, Thanks All!!!
kes
 
Hi,

You need to declare your col variable as static. This tells it to
always reference the one instance, and doesn't require you to create a
new instance each time.

Hope this makes sense.
Regards,

Peter Chadwick (MCP)
(e-mail address removed)
 
You need to move the code c.col=1 inside a method or the constructor and
initialize c. And col has to be a public member for you to be able to set
it.

Public Class crt
Public col As Integer
End Class
Public Class IndexBuilderDaily2
Inherits System.Web.UI.Page
Dim c As crt
Public Sub mymethod()
c = New crt
c.col = 1
End Sub
End Class

--
Gopal Rangaswamy
Microsoft Certified Solutions Developer
FMS, Inc.
<http://www.fmsinc.com/consulting>
<http://www.fmsinc.com/dotnet/SourceBook/>
 
Hi I have one more question
How can I Dim that Class as an Array? I like to have an array of 3
thanks
kes
 
Back
Top