How can I get valuemember from combobox binding with linq
cmb_projectName.DataSource = linq1.tbl_Projects.Select(c => new {c.ID,c.ProjectName }).ToList();
int projectID = Convert.ToInt32( cmb_projectName.SelectedValue);
cmb_projectName.DisplayMember = "ProjectName"; cmb_projectName.ValueMember = "ID";
cmb_projectName.SelectedValue ==> return {ID = 1, ProjectName = "projectname1" }
I want to return Just ID value;
What's the problem ??!!
The wrong code in your case:
The correct code: