I have a vb.net VS 2003 WinForms App with a combobox on a form that is a salesman selection coded as follows.
I set the RowFilter to an empty string because initially I want all salesman to show up in the combobox as the user moves through the records. These records are from more than one company, and each company has there own salesman. When the user decides to edit the record by clicking a button, I am trying to restrict the salesman in the combobox to be only the valid ones for that company. I have a sub that does the following.
SalesmanCompany is an integer column in the salesman table and Company is the integer column form the orders table that is passed in. The problem is when the user clicks the button, the value of the combobox changes from the original value to another salesman. The list has the proper values in it according to the company, but it displays the wrong value. I have tried refreshing the combobox, and resetting the datasource with no luck. I know this is probably something very simple, but I can't seem to get it to work properly.
Auguy
Northwest Ohio
Code:
dsSalesman = SelectSalesman("ALL")
SalesmanView = New DataView(dsSalesman.Tables(0))
cboSalesman.DisplayMember = "SalesmanText"
cboSalesman.ValueMember = "Salesman"
cboSalesman.DataBindings.Add("SelectedValue", dsOrders, "Order.Salesman")
cboSalesman.DataSource = SalesmanView
SalesmanView.RowFilter = ""
Code:
SalesmanView.RowFilter = "SalesmanCompany = " + Company.ToString
Auguy
Northwest Ohio