Reputation: 92
can anybody say me, how can I clear content inside RichTextBox using one button where: CheckedListBox - select which of rtb will be cleared?
I have problem with CheckedListBox - It works for one select position, but not for checked/marked.
Upvotes: 0
Views: 179
Reputation: 222720
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < checkedListBox1.Items.Count; i++)
{
if (checkedListBox1.GetItemChecked(i))
{
string str = (string)checkedListBox1.Items[i];
if(str == "rtb1")
{
richTextBox1.Clear();
richTextBox1.Focus();
}
if(str == "rtb2")
{
richTextBox2.Clear();
richTextBox2.Focus();
}
}
}
Upvotes: 1