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";
}

VulpesRank #55 · 29.2K reputationPosted Mar 30, 2012, 11:53 AM EDT
Samio170 reputationPosted Mar 30, 2012, 12:22 PM EDT
because I need to display "u.FirstName" in the textBox1
Thank you
VulpesRank #55 · 29.2K reputationPosted Mar 30, 2012, 3:10 PM EDT
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.
Samio170 reputationPosted Mar 31, 2012, 2:43 AM EDT
int ID = Convert.ToInt32(comboBox1.SelectedValue.ToString());
Text1.Text = dict[ID];
Thank you very much Vulpes.