Question ComboBox with AutoComplete - Text entered moves position of selected item?

tombihn

Member
Joined
Jan 17, 2011
Messages
10
Programming Experience
5-10
I have an Access database I have to retrieve Work Order information from. I have a ComboBox to list the work order numbers and various text boxes to show the data for the selected row of data based on the data shown in the ComboBox. I want the user to be able to be able to select the number and/or start typing it in and either select it then or finish typing and hit enter. As the user types, I want to update The CurrencyManager position to reflect the currently selected index.

When the user types in the work order number, while the initial selected index is returned correctly, the item is moved into position 0 automatically. This of course means if the user goes to select another order, everything will be off by one since I'm using the SelectedIndex property to set the CurrenctyManager position. I'm not completely sure if it is replacing the value for index 0 or if it is moving...

Here is the code I use to set the list for the combobox:

WorkOrderNumberCbo.DataSource = dsAccess.Tables("WorkOrders").DefaultView
WorkOrderNumberCbo.DisplayMember = "worknum"
WorkOrderNumberCbo.ValueMember = "worknum"

How do I prevent entered text in the list from changing (and possibly changing index as well) when selecting an item from the list?
 

tombihn

Member
Joined
Jan 17, 2011
Messages
10
Programming Experience
5-10
I found that my problem was binding to the same database field that I was using as my data source. Once I removed the binding the behavior went away.
 
Top Bottom