[RESOLVED] structures - Need specific item from the list
Hi, for example i have a structure class and obviously created a new list as so.
My UserControl creates the new car.
Code:
Private _car As New List(Of Car)
The car class had 5 members. One of which is Color
Code:
Public Color as string
In my user control i have a function as so.
Code:
Private Function CreateCar(*removed) As Car
Dim newCar As Car
newCar.Price = price
newCar. = Color
etc........
_car.Add(newCar)
lstCars.Items.Add(newCar)
Return newCar
End Function
I use a property to share information in the user control between usercontrol and main form
Code:
Public ReadOnly Property CarCollection As List(Of Car)
Get
Return _car
End Get
End Property
Now i need main form to be able to get one of the 5 members from each added string to the list.
(MainForm)
Code:
For Each line In _order.CarCollection
MessageBox.Show(_order.CollectionCollection....stuck here)
Next
I need mainform to be able to gather one part of each new generated cars structure.
bit stuck.
Re: structures - Need specific item from the list
Code:
For Each CurrentCar As Car In CarCollection
MessageBox.Show(CurrentCar.Color)
Next
I have to guess you do not have Option Strict turned on, or you did not show your declaration of line. Ensure you have it turned on !!
Re: structures - Need specific item from the list
Quote:
Originally Posted by
Grimfort
Code:
For Each CurrentCar As Car In CarCollection
MessageBox.Show(CurrentCar.Color)
Next
I have to guess you do not have Option Strict turned on, or you did not show your declaration of line. Ensure you have it turned on !!
I never program with out it on. I typed that in as an example. My miss take.
works a treat.
legend