Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

data bound combobox: list item changed when I select another

$
0
0

I have a ComboBox bound to the Company table.  I set DisplayMember to Company_name and ValueMember to Company_num.  When the app starts, the first company name is selected.  Other controls bound to the CompanyBindingSource display data for the first record in the Company table.

When I select another item from the dropdown list, the text of the ComboBox shows the selected company name and other bound controls display data for that company. 

Problem: When I drop the list, the first item in the list has been replaced with the new name.  If I click the first item again, the other bound controls go back to the first record, implying that I have changed the company name (first record) in my dataset.

If I continue to select items, it appears that
-when I select a new item > the previously selected name is changed to the newly selected name.

I have coded only 2 event handlers at this point:

1. form_Load: uses tableAdapter.Fill for each table

2.

	Private Sub Company_nameComboBox_DisplayMemberChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Company_nameComboBox.DisplayMemberChanged
		CompanyInfoBindingSource.Position = Company_nameComboBox.SelectedIndex

	End Sub
What is going on?  I have used bound ComboBoxes before without this behavior.

 

 


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>