dynamic bound controls

G

Guest

Hi
I try to create a few dynamic bound combobox controls, but as soon as i
select a value from one of the controls, all the other controls are change to
the value witch i've selected.

how can I make each combo ack by itself?

Thanks in advance
Y. Hergass
 
G

Guest

You need a binding source for each one. Each binding source only has one
current which the controls use.
 
L

Larry Lard

Hergass said:
Hi
I try to create a few dynamic bound combobox controls, but as soon as i
select a value from one of the controls, all the other controls are change to
the value witch i've selected.

how can I make each combo ack by itself?

Instead of (say)

comboBox1.Datasource = myDatasource;
comboBox2.Datasource = myDatasource;
comboBox3.Datasource = myDatasource;

do

BindingSource bs1 = new BindingSource();
bs1.Datasource = myDatasource;
comboBox1.Datasource = bs1;

BindingSource bs2 = new BindingSource();
bs2.Datasource = myDatasource;
comboBox2.Datasource = bs2;

BindingSource bs3 = new BindingSource();
bs3.Datasource = myDatasource;
comboBox3.Datasource = bs3;
 
G

Guest

Tank you for your help

I've Only added the .Copy to the DataTable:

for i = 1 to 10
dim DT as DataTable
DT=DS.Tables(TableName)

combo(i) = New ComboBox()
combo(i).Size = New Size(comboWidth, 21)
combo(i).Location = New Point(120, lineHeight * i + iTop)

combo(i).DataSource = DT.Copy

combo(i).ValueMember = "str"
combo(i).DisplayMember = "val"
combo(i).Name = tblName & "combo" & i.ToString
combo(i).Tag = i.ToString
grpBox.Controls.Add(combo(i))
next i

Thanks again
Hergass
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top