Hi all visitors
i have problem with array an object in vb.net
i have created class (class student)
public class student
private id as integer
private name as string
private gender as string
public property SetID() as string
Get
return id
end get
set(Byval value as string)
id=value
end set
end property
public property SetName() as string
Get
return name
end get
set(Byval value as string)
name=value
end set
end property
public function Display() as string
return id & vbTab & name
end function
end class
At the form load Event I write like this:
dim obj() as new student' if i declare object like it will error coz array can't use with "New"
so i need to declare like this:
dim obj() as student
redim preserve
obj(0).SetID=1
obj(0).SetName="AAA"
if i write like this, i will error say that "The object that i declare not yet set"
I don't know where should i set key word "New" of my student class.
Please help me, if i want to use array with object like that How i can do?
Best Regards,