Ejemplo n.º 1
0
        private void ProductsSearchButton_Click(object sender, EventArgs e)
        {
            ProductsDataGridView.ClearSelection();
            ProductsDataGridView.DefaultCellStyle.SelectionBackColor = Color.Yellow;
            bool found = false;

            if (ProductsSearchBar.Text == "")
            {
                MessageBox.Show("No Product name was input. Please input a product name to search.", "Product Name Not Entered");
            }
            else
            {
                for (int i = 0; i < Inventory.Products.Count; i++)
                {
                    if (Inventory.Products[i].Name.ToUpper().Contains(ProductsSearchBar.Text.ToUpper()))
                    {
                        ProductsDataGridView.Rows[i].Selected = true;
                        found = true;
                    }
                }
                if (!found)
                {
                    MessageBox.Show("No product with matching name was found.", "No Product Found");
                }
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            PartsDataGridView.DataSource = Inventory.AllParts;
            PartsDataGridView.ClearSelection();

            ProductsDataGridView.DataSource = Inventory.Products;
            ProductsDataGridView.ClearSelection();
        }
Ejemplo n.º 3
0
 private void SelectForm_Load(object sender, EventArgs e)
 {
     if (!HasLoadedDataSource())
     {
         MessageBox.Show("DataSource Not Loaded", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     // this clears the selection when the application loads
     ProductsDataGridView.ClearSelection();
     // these will disabled next button and dataTextbox
     SelectFormNextButton.Enabled = false;
     SelectionDataTextbox.Enabled = false;
 }