Data Bindings again
-
I tried every piece of code possible. The latest is: comboSelect1.DataBindings.Add("DisplayMember", dsDenumiri1.Tables["Denumiri"], "Statie_Nume"); comboSelect2.DataBindings.Add("DisplayMember", dsDenumiri2.Tables["Denumiri"], "Statie_Nume"); comboSelect1.DataBindings.Add("ValueMember", dsDenumiri1.Tables["Denumiri"], "StatieID"); comboSelect2.DataBindings.Add("ValueMember", dsDenumiri2.Tables["Denumiri"], "StatieID"); but i just can't bind these 2 comboboxes to the datasets! the error is the same: An unhandled exception of type 'System.ArgumentException' occurred in system.dll Additional information: Could not bind to the new display member. Please Help me!! rzvme
-
I tried every piece of code possible. The latest is: comboSelect1.DataBindings.Add("DisplayMember", dsDenumiri1.Tables["Denumiri"], "Statie_Nume"); comboSelect2.DataBindings.Add("DisplayMember", dsDenumiri2.Tables["Denumiri"], "Statie_Nume"); comboSelect1.DataBindings.Add("ValueMember", dsDenumiri1.Tables["Denumiri"], "StatieID"); comboSelect2.DataBindings.Add("ValueMember", dsDenumiri2.Tables["Denumiri"], "StatieID"); but i just can't bind these 2 comboboxes to the datasets! the error is the same: An unhandled exception of type 'System.ArgumentException' occurred in system.dll Additional information: Could not bind to the new display member. Please Help me!! rzvme
Hi First you shouldn't add two bindings to the same cotrol. Second for the combo you have the list datasource which is the datatable in your case and which uses DisplayMember and ValueMember and also you have the current record which you want to edit. You should try to use only one binding on "StatieID" and when the combo value is changed change the name. ALso you should check that the datasource set on the combo contains the two columns ("Statie_Nume", "StatieID") damianbc