Disclaimer: I'm a newbie that's been working with VB.net for under a
month.
I have two listboxes. Listbox1 contains collections. Selecting an item
in listbox1 and pressing a control button sends the collection to
Listbox2. When the item is in Listbox2 it you are able to edit the
collections properties via textboxes that appear using the
flowlayoutpanel.
All of this works fine as long as the same collection doesn't appear
twice in Listbox2. For instance if Listbox1 contains the collection
Spices and Sweetners for use in a recipe, if Spices appears in Listbox2
more than once (i.e. using more than one spice in the recipe) the
values entered for one spice collection are copied to every other spice
collection in Listbox2. I want to be able to have two collections of
the same type in Listbox2 with each being able to have their own unique
values.
I think the problem is in Sub ListBox2_SelectedIndexChanged
Here is my code:
************** Begin Code **************
Private Sub ListBox2_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ListBox2.SelectedIndexChanged
Dim ingredient As ingredientlist
ingredient = Me.ListBox2.SelectedItem
FlowLayoutPanel1.Controls.Clear()
Dim ingprop As ingredient
Dim lbl As Label
Dim txtbox As TextBox
Dim setbutton As Button
For Each ingprop In ingredient.propertyList
lbl = New Label()
lbl.Text = "Property"
FlowLayoutPanel1.Controls.Add(lbl)
txtbox = New TextBox
txtbox.DataBindings.Add("Text", ingprop, "name", True,
DataSourceUpdateMode.OnPropertyChanged)
Me.FlowLayoutPanel1.Controls.Add(txtbox)
setbutton = btn_setval
FlowLayoutPanel1.Controls.Add(setbutton)
FlowLayoutPanel1.SetFlowBreak(setbutton, True)
Next
End Sub
************** End Code **************
Thanks for all your help.
-Blake