I am trying to create a Windows Form Application where I insert values for a contract, and in this contract I need the ID of the employee that worked on it. I've added a ComboBox and added the name and surname of a selected employee to the display
member and added the ID to it's value member. After I select one employee, my selection is stuck in the ComboBox until I write a number since it's either selecting a null value or a String. I've connected the database with LINQ.
}
This is my code for the ComboBox selection:
private void vrabotenIDComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
var imeVrab = (from vrab in dc.Vrabotenis
orderby vrab.VrabotenID
select new { vrab.VrabotenID, VImeP = vrab.Ime + " " + vrab.Prezime }); //selecting
employeeID(VrabotenID) and selecting employee name and surname (VimeP)
vrabotenIDComboBox.DataSource = imeVrab.ToList();
vrabotenIDComboBox.DisplayMember = "VImeP";
vrabotenIDComboBox.ValueMember = "VrabotenID";
}