DangerRanger89
New member
- Joined
- Apr 5, 2011
- Messages
- 3
- Programming Experience
- Beginner
I've looked around at other forums and have seen that this is thrown because I am adding items to a collection in a for each statement. If I understand that right, I need a different way to populate my combobox here's the code.
Private Sub ShaftLoad()
Dim shaftlist As New List(Of Shaft)
shaftlist = DBShaft.GetShaftList
For Each Shaft In shaftlist
ShaftComboBox.Items.Add(Shaft.ShaftName)
Next
End Sub
This gets a list of all of the Shafts in the DB. I only need the name of the Shafts to be loaded into the combobox.
What can I do to accomplish this without modifying the collection?
Private Sub ShaftLoad()
Dim shaftlist As New List(Of Shaft)
shaftlist = DBShaft.GetShaftList
For Each Shaft In shaftlist
ShaftComboBox.Items.Add(Shaft.ShaftName)
Next
End Sub
This gets a list of all of the Shafts in the DB. I only need the name of the Shafts to be loaded into the combobox.
What can I do to accomplish this without modifying the collection?
Last edited: