private void ClearControls() { ProductNameTextBox.Clear(); SupplierComboBox.SelectedIndex = -1; CategoryComboBox.SelectedIndex = -1; PurchasePriceTextBox.Clear(); SalesPriceTextBox.Clear(); foreach (DataGridViewRow row in SizeDataGridView.Rows) { row.Cells["select"].Value = 0; } ProductNameTextBox.Focus(); }
private bool IsValid() { if (ProductNameTextBox.Text.Trim() == string.Empty) { MessageBox.Show("Product Name is required!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); ProductNameTextBox.Focus(); return(false); } if (PurchasePriceTextBox.Text.Trim() == string.Empty) { MessageBox.Show("Purchase Price is required!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); PurchasePriceTextBox.Focus(); return(false); } return(true); }