Given my table primary table for the binding navigator:
CREATE TABLE [dbo].[asset](
[assetID] [int] IDENTITY(1,1) primary key,
[assetTag] [varchar](15) NULL,
[assetModelId] [int] NOT NULL,
[employeeId] [int] NULL references employee(employeeid),
[LocationId] [int] NULL,
[purchasedDate] [smalldatetime] NULL,
[purchasedby] [int] NULL references employee(employeeid),
[depreciated] [tinyint] NULL,
[addedDate] [smalldatetime] NULL CONSTRAINT,
[addedBy] [int] NULL references employee(employeeid),
[disposalDate] [smalldatetime] NULL
Here's the bindingNavigator binding:
bindingNavigator1.BindingSource = _formData.BsAssets; // binding source for the asset table(linq-to-sql dbml)
Here's the binding code for the comboBox:
_BsAsset.DataSource = _formData.GPS.dc.assets;
_BsUser.DataSource = _formData.GPS.dc.employees;
cmbUser.DisplayMember = "userName";
cmbUser.ValueMember = "employeeId";
cmbUser.DataSource = _BsUser;
cmbUser.DataBindings.Add("SelectedValue", _BsAsset, "employeeId");
Each time I select a value on the combo box it stays... until the control loses focus, then it sets it back to a blank(null).
The combo box is set to DropDown mode so that users can add new values on that table directly from this comboBox. If I type in a value that value stays( I haven't put any code in to implement this functionality yet).
I am using the same code to bind combo boxes to the other two values that reference the employee table, with the same result. Why does it keep setting it back to null after I select something?