0

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());
} 
Xavier J
  • 4,326
  • 1
  • 14
  • 25
Cyber Space
  • 53
  • 1
  • 1
  • 8

1 Answers1

-1

I do not know how to write this solution without sounding like a commercial, but try the free trial of Resharper. You will get exactly what you are looking for.

JabberwockyDecompiler
  • 3,318
  • 2
  • 42
  • 54