I have a winform c# checkedlist box. This checklist box is Databound. It's Display Member contains names of student and valueMember contains their ID's. From the checklistbox, when I check any item, I want it to show their corresponding ID as present in ValueMember. At present in the ItemCheck event. I am iterating all the checked items and showing their ValueMember.
Is it possible to get the ValueMember property without iterating through the list? I would prefer a one or two line solution.
foreach (DataRowView view in chkLBoxNames.CheckedItems)
{
MessageBox.Show(view[chkLBoxNames.ValueMember].ToString());
}