CheckedListBox - ValueMember

T

Tonya

Hi!

I have a CheckedListBox, bound to a DataSet using
DisplayMember and ValueMember. I need to have the
ValueMember of all checked items in run time. the only
way to receive ValueMember is through the SelectedValue,
which is not useful in my situation.


what is the best way to have the collection of
ValueMembers, based on the collection of Checked items?

Thanks in advance,
Tonya.
 
P

Philip Rieck

Iterate through the SelectedItems instead

int val;
foreach(DataRowView dr in listBox1.SelectedItems)
{
val = int.Parse(dr[ listBox1.ValueMember ]);
MessageBox.Show( this, "Value = " & val.ToString());
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top