Hello,
creating DataTable with content:
table: janein
ID | janein
-----------
0 | nein
1 | ja
now I bind this table to different comboboxes that then is just the content of the table 'janein' able
Combo 'AbPf':
Combo 'Zwang':
Problem: if I switch the value of one Combobox, all Comboboxes switch their values to that I selected. THERE ARE NO EVENTS ON THESE COMBOBOXES! So I assume, that the binding is also reverse. Thats amazing and it would mean to create a DataTable for each Combobox.
It doesn't make sense at all. the binding (to my mind) is just oneway - take the Value 'Zwang' out of the table 'daten_antragsteller'. this is your Valuemember of the table 'janein'. get the related DisplayMember an show that in the Combobox. on swiching the value, save the Valumember in the table...
where is the bug?
thx and greets
KriZa
creating DataTable with content:
VB.NET:
Dim janein As DataTable = New DataTable("janein")
janein.Columns.Add("ID", Type.GetType("System.Int32"))
janein.Columns.Add("janein", Type.GetType("System.String"))
janein.PrimaryKey = New DataColumn() {janein.Columns("ID")}
Dim janein0 As DataRow = janein.NewRow()
janein0("ID") = 0
janein0("janein") = "Nein"
janein.Rows.Add(janein0)
Dim janein1 As DataRow = janein.NewRow()
janein1("ID") = 1
janein1("janein") = "Ja"
janein.Rows.Add(janein1)
table: janein
ID | janein
-----------
0 | nein
1 | ja
now I bind this table to different comboboxes that then is just the content of the table 'janein' able
Combo 'AbPf':
VB.NET:
.AbPf.DataSource = janein
.AbPf.DisplayMember = "janein"
.AbPf.ValueMember = "ID"
.AbPf.DataBindings.Add(New Binding("SelectedValue", bs_daten_antragsteller, "Abtretung_Pfaendung"))
Combo 'Zwang':
VB.NET:
.Zwang.DataSource = janein
.Zwang.DisplayMember = "janein"
.Zwang.ValueMember = "ID"
.Zwang.DataBindings.Add(New Binding("SelectedValue", bs_daten_antragsteller, "Zwang"))
Problem: if I switch the value of one Combobox, all Comboboxes switch their values to that I selected. THERE ARE NO EVENTS ON THESE COMBOBOXES! So I assume, that the binding is also reverse. Thats amazing and it would mean to create a DataTable for each Combobox.
It doesn't make sense at all. the binding (to my mind) is just oneway - take the Value 'Zwang' out of the table 'daten_antragsteller'. this is your Valuemember of the table 'janein'. get the related DisplayMember an show that in the Combobox. on swiching the value, save the Valumember in the table...
where is the bug?
thx and greets
KriZa