private void btn_Delete_Click(object sender, EventArgs e) { ColorType colorType = FormToColorTypes(); CarDesignArr carDesignArr = new CarDesignArr(); carDesignArr.Fill(); if (colorType.Id == 0) { } else { if (carDesignArr.DoesExist(colorType)) { MessageBox.Show("You can not delete this Car color, it is connected" + " to 1 or more Orders", "Can not delete Color Type", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (MessageBox.Show("Are you sure you want to delete this" + " Color Type? ", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { colorType.Delete(); ClearForm(); ColorTypesArrToForm(null); } } } }