Question ComboBox/Textbox and databinding

dsk96m

Well-known member
Joined
Jan 11, 2013
Messages
173
Programming Experience
1-3
This might be a dump question and I am just overlooking something.

I have a combobox with a datasource to a dataset datatable. It list a bunch of IDs. Next to it, I have a bunch of textboxes that i bound to other fields of that datatable. When I open the form, the combobox is empty like it should be. But the text boxes are displaying data from the first row of the binding source. I only want data to show up once I select and ID from the combobox. I can't set the bindingsource to nothing or -1 I dont think. i tried to set position to -1, that didnt work. What am I missing? All textbox databindings are set at design time.

Please help. Thank you
 
Presumably you're setting the SelectedIndex of the ComboBox to -1 or the SelectedItem to Nothing. When you do that, is the Current property of the BindingSource Nothing or does it still have a value? If it's the latter you're basically out of luck as long as the TextBoxes are bound. Your only option would be to clear the bindings in the designer and then create them in code once the user selects an item in the ComboBox for the first time.
 
Back
Top