How do I loop through a CheckedListBox and look at the name and if the name is in a string, check it.
I can figure out how to get the name:
foreach (var item in chkSelectStatementColumns.Items)
{
if (lbStatementNames.Text.IndexOf(item.ToString()) != -1)
{
MessageBox.Show(item.ToString());
}
}
But how do I check it?
I can check it using a for loop but how to I get the text?
I can't seem to figure out how to do both: get the text of the checkbox and then check or uncheck it.
Thanks,
Tom
I can figure out how to get the name:
foreach (var item in chkSelectStatementColumns.Items)
{
if (lbStatementNames.Text.IndexOf(item.ToString()) != -1)
{
MessageBox.Show(item.ToString());
}
}
But how do I check it?
I can check it using a for loop but how to I get the text?
I can't seem to figure out how to do both: get the text of the checkbox and then check or uncheck it.
Thanks,
Tom