printmedia
asked on
Databinding not working with combox vb.net
Hi all.
I'm working on some vb.net code that is not working as I'd like. I have form1 that has a datagrid. When the end user right clicks a record in the datagrid and selects "View Details" then it opens form2 with record information. One of those fields is a combo box. When form2 opens I want it to display the selected value to equal whatever "MinQtyValue" is. Unfortunately, when form2 opens it does not show a selection. Below is my code, I also added a databinding to a textbox to make sure there was data and yes, when form2 opens the textbox shows "MinQtyValue" but the combobox does not:
Thank you in advance!
I'm working on some vb.net code that is not working as I'd like. I have form1 that has a datagrid. When the end user right clicks a record in the datagrid and selects "View Details" then it opens form2 with record information. One of those fields is a combo box. When form2 opens I want it to display the selected value to equal whatever "MinQtyValue" is. Unfortunately, when form2 opens it does not show a selection. Below is my code, I also added a databinding to a textbox to make sure there was data and yes, when form2 opens the textbox shows "MinQtyValue" but the combobox does not:
sda.Fill(ds, "MinQtyValue")
bs = New BindingSource(ds, "MinQtyValue")
DataBindings.Clear()
frm.txtMinQtyValue.DataBindings.Add("Text", bs, "MinQtyValue")
sda.Fill(ds, "MinQtyValue")
bs = New BindingSource(ds, "MinQtyValue")
DataBindings.Clear()
frm.cmbSetMin.DataBindings.Add("SelectedValue", bs, "MinQtyValue")
Thank you in advance!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.