jamie

jamie

  • NA
  • 26
  • 0

checkedListbox Help Please

Jan 22 2008 7:34 PM

 I am trying to figure out checkedListBoxes. I have found out through hours of searching how to display the index of the items as well as the items themselves.

 

int i;

string s;

s = "Checked items:\n";

for (i = 0; i <= (checkedListBox1.Items.Count - 1); i++)

{

if (checkedListBox1.GetItemChecked(i))

{

s = s + "Item " + (i + 1).ToString() + " = " + checkedListBox1.Items[i].ToString() + "\n";

MessageBox.Show(s);

 

what i cannot figure out is how to display information based on what is checked. like for example.

I have a list of names and each name carries 10 values that i need to print to a text file. How do i get the code to recognize the index and print the values based on what is checked? so if index 0 is checked then print x,y,z?


Answers (4)