Array data passed between class'

Dispair

New member
Joined
Feb 5, 2006
Messages
2
Location
pa,usa
Programming Experience
3-5
I am trying to write a seemingly simple program. However when i was createing the array in a class called "Levels" I was unable to use the data in Class "form1" how would i transport the data from "Levels" to "Form1"
Here is a sample of what i have:

Public Class Levels

Public Shared Sub createBlackArray()
Dim blackArray(299,3)
blackArray(0,0) = 0
blackArray(0,1) = 0
blackArray(0,2) = 0
blackArray(1,0) = 0
blackArray(1,1) = 40
blackArray(1,2) = 1

End Sub
Shared Sub createGreenArray()
MsgBox("createGreenArray")
End Sub
Shared Sub createBlueArray()
MsgBox("createBlueArray")
End Sub
End Class
from the MsgBox's i can see that i am able to access the class and sub's however i am not able to get the data to translate to the original class "Form1".
 
VB.NET is an object-oriented language. I think that it's safe to say that you having grasped exactly what that means. That's no shame as most people have trouble coming to terms with it at first. The silly thing is that OOP mimics the real world, but people have trouble transferring their knowledge of the real world to the slightly more abstract world of programming. I'm afriad that you probably need to do some reading on classes and OOP. At the moment you are almost certainly misusing the Shared keyword for a start. I suggest that you have a look at the StartVBDotNet link in my signature. It has a section about OOP.
 
Back
Top