Promblem with dynamically creating comboboxes in VS.NET 2K3
-
Hi, I am looping through a database and creating dropdown lists dynamically using the combobox control and binding it to an arraylist with valid values. However I must be doing something wrong because when I run the code, all the comboboxes are linked together, in other words if I change the value of one of the comboboxes, all of them are changed. Here is some sample code: ------------------------------------------------ Dim fieldlabel As Windows.Forms.Label Dim filefields As Windows.Forms.ComboBox While myreader.Read If myreader("FLD_0") <> "/" Then Panel1.Controls.Add(New Windows.Forms.Label) fieldlabel = Panel1.Controls(controlindex) fieldlabel.Text = counter & ") " & X3Reader("FLD_0") fieldlabel.Location = New Point(1, ycord) fieldlabel.Size = New Size(100, 20) fieldlabel.Name = "label" & counter controlindex += 1 Panel1.Controls.Add(New Windows.Forms.ComboBox) filefields = Panel1.Controls(controlindex) temparrlist = New ArrayList temparrlist = filefieldsarrlist filefields.DataSource = temparrlist filefields.DropDownStyle = ComboBoxStyle.DropDownList filefields.Size = New Size(100, 20) filefields.Location = New Point(105, ycord) filefields.Name = "map" & counter controlindex += 1 ycord += 30 counter += 1 controlindex += 1 End If End While ------------------------------- Any ideas?