private void button5_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("Please select the row, which you want to delete!"); return; } //Изпраща се завката за изтриване if (!DBConnection.DeleteWorkerbyID(textBox1.Text)) { MessageBox.Show("There is a problem with deleting this worker! Maybe this worker doesn't exist in the database! :("); } else { MessageBox.Show("The worker is deleted successfully!"); } //Премахва се от листбокса и от комбото //depListB.Items.RemoveAt(delCombo.SelectedIndex); //delCombo.Items.RemoveAt(delCombo.SelectedIndex); }