In C#, I am trying to Check an item in a CheckBoxList where the text equals what I require.
I would modify the code to check items that exist in the database.
<
//Multiple selection:
private void clbsec(CheckedListBox clb, string text)
{
for (int i = 0; i < clb.Items.Count; i++)
{
if(text == clb.Items[i].ToString())
{
clb.SetItemChecked(i, true);
}
}
}
using ==>
clbsec(checkedListBox1,"michael");
or
clbsec(checkedListBox1,textBox1.Text);
or
clbsec(checkedListBox1,dataGridView1.CurrentCell.Value.toString());