//Methods ------------------------------------------------------------------------------------------------------------------------------ private void PartsSearchButton_Click(object sender, EventArgs e) { PartsDataGridView.ClearSelection(); PartsDataGridView.DefaultCellStyle.SelectionBackColor = Color.Yellow; bool found = false; if (PartsSearchBox.Text == "") { MessageBox.Show("No Part name was input. Please input a part name to search.", "Part Name Not Entered"); } else { for (int i = 0; i < Inventory.AllParts.Count; i++) { if (Inventory.AllParts[i].Name.ToUpper().Contains(PartsSearchBox.Text.ToUpper())) { PartsDataGridView.Rows[i].Selected = true; found = true; } } if (!found) { MessageBox.Show("No part with matching name was found.", "No Part Found"); } } }
private void ModifyProductForm_Load(object sender, EventArgs e) { PartsDataGridView.DataSource = Inventory.AllParts; PartsDataGridView.ClearSelection(); AssociatedPartsDataGridView.DataSource = Inventory.CurrentProduct.AssociatedParts; AssociatedPartsDataGridView.ClearSelection(); }
private void Form1_Load(object sender, EventArgs e) { PartsDataGridView.DataSource = Inventory.AllParts; PartsDataGridView.ClearSelection(); ProductsDataGridView.DataSource = Inventory.Products; ProductsDataGridView.ClearSelection(); }