reference arrays of object individually within button

lucho_1

New member
Joined
Mar 21, 2008
Messages
2
Programming Experience
1-3
i have a problem guys this is my problem ... i have created a class called <Car> and it has the following attributes "MotorId", "Description", "RPM",
and "State"

then i have a form1 which is the main form and the other one frmOutput thats going to show the output per each motor car that has been created using the MotorId and chosing them with a comboBox in frmOutput.


so my question is: if a have to create an array of 9 motors how would i input the data to each individual motor in the array everytime i press the "btnAdd" , i tried a for loop but what the loop does is save that same data in the 9 objects....... any suggestions or assistenc on this would be greatly appreciated....... thank you guys
 
VB.NET:
dim carArray as Arraylist

private sub Add()
dim myCar as NEW Car()

myCar.MotorID = 1
myCar.Description = "This is my car"
myCar.RPM = 3000
myCar.State = "Ohio"

carArray.add(myCar)
end sub
 
Back
Top