2

I wante to do something like this.

String s = "";
foreach (var item in checkedListBox1.Items)
{
        s = checkedListBox1.Items(item).tostring;
         // do something with the string
}

I want to have the string of the item which is in the list box.

How can I get it runnig?

0

3 Answers 3

1

I haven't try it yet but I think this should work.

string s = "";
foreach (var item in checkedListBox1.Items)
{
        s = item.ToString();
         // do something with the string
}
Sign up to request clarification or add additional context in comments.

1 Comment

I just forgot the () in my tests ... sorry
0
string  s = "";
foreach (string item in checkedListBox1.Items)
{
   s = item;
   // do something with the string

}

Comments

0

I believe what you are looking for is this:

foreach (var item in checkedListBox1.Items)
{
    checkedListBox1.GetItemText(item);
}

Probably not the most useful, but here is the MSDN for it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.