How can I do that in LINQ ?
My code is as follows
using (LINQtoEntitiesEntities MyEntities = new LINQtoEntitiesEntities())
{
ObjectQuery
comboBox1.DataSource = (from u in Emp select new { u.ID, u.LastName, u.FirstName }).ToList();
comboBox1.ValueMember = "ID";
comboBox1.DisplayMember = "LastName";
}
VulpesPosted Mar 30, 2012, 3:53 PM
SamioPosted Mar 31, 2012, 6:43 AM
int ID = Convert.ToInt32(comboBox1.SelectedValue.ToString());
Text1.Text = dict[ID];
Thank you very much Vulpes.
VulpesPosted Mar 30, 2012, 7:10 PM
So, when the selected value (ID) changes in the combobox, the code should write the corresponding FirstName to the textbox.
The LastName should, of course, be displayed in the combobox itself.
SamioPosted Mar 30, 2012, 4:22 PM
because I need to display "u.FirstName" in the textBox1
Thank you