I can write some nasty unnecessary code to solve this problem. But, I would like to know the correct manner for fixing it.
Cut to the chase.
I have two comboboxes, one is bound to the other. So if I select a record in one combobox; only related records are displayed in the other. – This works fine
When I select a record in my first combobox and leave the first displayed value alone in my second combobox. I get a null value error when I update the database.
I noticed the SelectedIndexChanged Event never fires until I litterly select something from combobox # 2. When I do, the update works fine.
I want to update with the first item showing in combobox # 2 if I don't select another value.
EDIT:
I found a post on here that was not resolved. He had the same problem I am trying to figure out
http://www.vbdotnetforums.com/showthread.php?t=18271
Cut to the chase.
I have two comboboxes, one is bound to the other. So if I select a record in one combobox; only related records are displayed in the other. – This works fine
When I select a record in my first combobox and leave the first displayed value alone in my second combobox. I get a null value error when I update the database.
I noticed the SelectedIndexChanged Event never fires until I litterly select something from combobox # 2. When I do, the update works fine.
I want to update with the first item showing in combobox # 2 if I don't select another value.
'
'ComboBoxCustomer
'
Me.ComboBoxCustomer.DataBindings.Add(New System.Windows.Forms.Binding("SelectedValue", Me.objLabDemo, "tblLog.customerID"))
Me.ComboBoxCustomer.DataSource = Me.objLabDemo.tblCustomers
Me.ComboBoxCustomer.DisplayMember = "customer"
Me.ComboBoxCustomer.ValueMember = "CustomerID"
'
'ComboBoxPart
'
Me.ComboBoxPart.DataBindings.Add(New System.Windows.Forms.Binding("SelectedValue", Me.objLabDemo, "tblLog.partID"))
Me.ComboBoxPart.DataSource = Me.objLabDemo.tblCustomers
Me.ComboBoxPart.DisplayMember = "tblCustomerstblPartNumbers.partnum"
Me.ComboBoxPart.ValueMember = "tblCustomerstblPartNumbers.partId"
EDIT:
I found a post on here that was not resolved. He had the same problem I am trying to figure out
http://www.vbdotnetforums.com/showthread.php?t=18271
Last edited: