Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Combobox behavior
 

Combobox behavior

I'm beginning to think that the developers of VB2005 were on A-class drugs at the time!

I've been writing software for many years and until now, never had to ask for help.

Now, even the most simple tasks are infuriating! (Read my other posts)

Here's my next problem:

I have a form with a BindingNavigator, BindingSource and BindingTableAdapter bound to the "Customers" table of my database, a BindingSource and BindingTableAdapter bound to the "CustomerCars" table of my database which is filtered to show only the records relevant to the current customer and a ComboBox from hell bound to the CustomerCarsBindingSource to list the registration numbers of the relevant cars.

Everything works fine and the ComboBox lists the relevant cars however, when I select another item in the ComboBox and change the CustomerCarsBindingSource.Position to show the details of the associated car, the Combobox does weird things eg:

Original list = CARS 001, CARS 002, CARS 003

After selecting CARS 002:

List = CARS 002, CARS 002, CARS 003

After selecting CARS 003:

List = CARS 002, CARS 003, CARS 003

Why is this? Please somebody either tell me how to resolve this or tell me that the developers have been arrested, either would make me very happy.

Matt Deane  Wednesday, October 25, 2006 1:54 PM

Without seeing your code, I can't be 100% sure, but I think I might see what is going on.

I think when you selected the second item in the combobox, your code updated the binding of the first item in the list with the second item. When you selected the third item, it updated the second itemin the list with the third item. I think either you have an index problem where youhave an "off by 1" error, oryou may be updatingthe item that was previously selected with the one you just selected.

I think it may be something to do with changing the bindingsource.position, as you described doing. In any case,I think it would help to diagnose your problem better if you posted a code sample, so I could see how your code is actually set up.

John_Lee - MSFT  Friday, October 27, 2006 11:55 PM
Moved to Windows Forms Databinding forum.
nobugz  Saturday, October 28, 2006 12:05 PM
Thank you for your reply. I found that the text property for the combobox had been bound twice giving the strange behaviour. It's something for others to watch out for though.
Matt Deane  Sunday, October 29, 2006 3:20 AM

You can use google to search for other answers

Custom Search

More Threads

• ColumnChanged event not fired when current column value is changed
• Right Click Pop Up Box on a Datagridview
• Update UI Thread
• How to update dataset
• Can't DataBind Combobox (System.Data.DataRowView)
• Image Column and DataGridView
• Error on filling empty field datatable using ODBC.DataAdapter?
• DataGridView and the clipboard
• Datagrid View
• how do it remove an item from a checkedListBox?