tux007
tux007

Reputation: 312

Get string of item from checkboxlist

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?

Upvotes: 2

Views: 1658

Answers (3)

Shulhi Sapli
Shulhi Sapli

Reputation: 2476

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
}

Upvotes: 1

Mike C.
Mike C.

Reputation: 3114

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.

Upvotes: 0

Abdusalam Ben Haj
Abdusalam Ben Haj

Reputation: 5423

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

}

Upvotes: 0

Related Questions