Dynamically Creating Comboboxes

curtis111

New member
Joined
Jun 6, 2007
Messages
3
Location
Berkeley, CA
Programming Experience
5-10
Hi VB.netters,

I'm relatively new to client programming (I usually do web stuff). I have a problem with this code:

VB.NET:
Dim WashType As New ComboBox
        WashType.Location = New Point(6, y)
        WashType.Size = New Size(261, 21)
        WashType.Name = "WashComboBox" + i.ToString
        WashType.DataSource = ds.Tables(0) ' connected to a single DataSet
        WashType.DisplayMember = "Name"
        WashType.ValueMember = "WashTypePriceID"
        WashPanel.Controls.Add(WashType)
        y += 26

What's supposed to happen is an initial combobox is created on load. I enter information to the line and a new line is created below the original. I created a button to check the code functionality and found that each new combobox is bound to each other. IOW, I select one combobox and all the other boxes change their value.

How can I make each combobox independent of each other? Does anyone have an example of dynamically created comboboxes?

Thanks,

Curtis
 
Back
Top