Create multiple instance of class

jfavell

New member
Joined
Apr 21, 2007
Messages
2
Programming Experience
Beginner
I have created a class library, which I then create an instance of in a form. I wish to be able to create multiple instances of this class all with different names.

My problem is that each object I create points to a single instance of the class rather than creating a new one.

Pseudo code:-

Dim obj1 As New clsJohn.MyClass
obj1.Name =
"John"

Dim obj2 As New clsJohn.Myclass
obj2.name =
"Fred"


at this point both obj1.name and obj2.name equal "Fred"

I have tried dim obj1 as clsjohn.myclass = new clsjohn.myclass but with no difference.

Does anyone have any ideas? Ive searched google all morning for some clues, but am completely stuck.

Hope someone can help :)




 
Well they actually appear that way hence me posting the thead......

But, ive realised why. The variables that hold the properties were declared friend in a module so both instances of the class were using the same variable hence returning the same properties.
 
Back
Top