private void ComboBoxItemName_Leave(object sender, EventArgs e) { if (!ComboBoxItemName.Items.Contains(ComboBoxItemName.Text)) { DialogResult result = MessageBox.Show("the item does not exist, would you like to add a new item?", "Confirmation", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { NewService NewServiceObj = new NewService(ComboBoxVehicleModel.Text.Trim(), ComboBoxVehicleName.Text.Trim(), ComboBoxItemName.Text.Trim()); NewServiceObj.ShowDialog(); getItemsData(); ComboBoxItemName.Text = ""; ComboBoxItemName.Focus(); } ComboBoxItemName.Text = ""; } }
private void ButtonNewService_Click(object sender, EventArgs e) { NewService NewServiceObj = new NewService(); NewServiceObj.ShowDialog(); }