No Class at ALL!!! beginner/beginner question

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
 
P

Peter Chadwick (MCP)

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)
 
G

Gopal \(FMS, Inc.\)

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/>
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top