// Add Product Button Click event. private void AddProductButton_Click(object sender, EventArgs e) { this.Hide(); indexOfSelectedPart = -1; dataGridViewProducts.SelectionMode = DataGridViewSelectionMode.FullRowSelect; ProductScreen addProductScreen = new ProductScreen(); // Change addModifyProductLabel Text to Add Product. addProductScreen.addModifyProductLabel.Text = "Add Product"; addProductScreen.productIDTextBox.Text = Inventory.CurrentProduct.ProductIDCount.ToString(); // Change text colors to silver. addProductScreen.productNameTextBox.ForeColor = Color.Silver; addProductScreen.inventoryTextBox.ForeColor = Color.Silver; addProductScreen.priceCostTextBox.ForeColor = Color.Silver; addProductScreen.maxTextBox.ForeColor = Color.Silver; addProductScreen.minTextBox.ForeColor = Color.Silver; addProductScreen.ShowDialog(); }
private void ModifyProductsButton_Click(object sender, EventArgs e) { // Modify Existing Product. if (indexOfSelectedProduct >= 0) { this.Hide(); ProductScreen modifyProductScreen = new ProductScreen(); // Change addModifyProductLabel Text to Modify Product. modifyProductScreen.addModifyProductLabel.Text = "Modify Product"; modifyProductScreen.productNameTextBox.Text = Inventory.CurrentProduct.ProductName; modifyProductScreen.inventoryTextBox.Text = Inventory.CurrentProduct.InStock.ToString(); modifyProductScreen.priceCostTextBox.Text = Inventory.CurrentProduct.ProductPrice.ToString(); modifyProductScreen.maxTextBox.Text = Inventory.CurrentProduct.Max.ToString(); modifyProductScreen.minTextBox.Text = Inventory.CurrentProduct.Min.ToString(); modifyProductScreen.Show(); } // Select a product to Modify. else { MessageBox.Show("Select a Product to modify!"); } }