После ввода в текстовое поле textBox4 и нажатия на кнопку добавить.
| Код | private void button1_Click(object sender, EventArgs e) { if (textBox3.Focused == false) { string NewItem = this.textBox3.Text;
if (NewItem == "") return;
for (int j = 0; j < checkedListBox15.Items.Count; j++) { if (NewItem == checkedListBox15.Items[j].ToString()) { MessageBox.Show(NewItem + " уже существует!"); return; } } this.checkedListBox15.Items.Add(NewItem); this.textBox3.Text = ""; this.textBox3.Focus(); }
if(textBox4.Focused == false) { string NewItem1 = this.textBox4.Text;
if (NewItem1 == "") return;
for (int jk = 0; jk < checkedListBox1.Items.Count; jk++) { if (NewItem1 == checkedListBox1.Items[jk].ToString()) { MessageBox.Show(NewItem1 + " уже существует!"); return; } } this.checkedListBox1.Items.Add(NewItem1); this.textBox4.Text = ""; this.textBox4.Focus(); } }
|
|