/** Add Category Item **/ private void addCategoryToolStripMenuItem_Click(object sender, EventArgs e) { AddCategory _AddCategory = new AddCategory(); //Retreive CatgeoriesAgain to Show on SuppliersFlow Panel if (_AddCategory.ShowDialog() == DialogResult.OK) { SuppliersFlowPanel.Controls.Clear(); DataAccess _DataAccess = new DataAccess(); ArrayList AllSuppliers = _DataAccess.RetreiveAllSuppliersFromDatabase(); foreach (Category Category in AllSuppliers) { Button btn = new Button(); btn.Text = Category.Name; btn.Size = new System.Drawing.Size(80, 80); btn.ForeColor = Color.White; btn.Tag = Category.ID; SuppliersFlowPanel.Controls.Add(btn); btn.Click += CategoryButtonClick; } } }
private void addCategoryToolStripMenuItem_Click(object sender, EventArgs e) { AddCategory _AddCategory = new AddCategory(); //Retreive CatgeoriesAgain to Show on CategoriesFlow Panel if (_AddCategory.ShowDialog() == DialogResult.OK) { CategoriesFlowPanel.Controls.Clear(); DataAccess _DataAccess = new DataAccess(); ArrayList AllCategories = _DataAccess.RetreiveAllCategoriesFromDatabase(); foreach (Details Category in AllCategories) { Button btn = new Button(); btn.Text = Category.Name; btn.Size = new System.Drawing.Size(80, 80); btn.ForeColor = Color.White; MemoryStream ms = new MemoryStream(Category.Picture); btn.Image = Image.FromStream(ms); btn.Image = new Bitmap(btn.Image, btn.Size); btn.Tag = Category.ID; CategoriesFlowPanel.Controls.Add(btn); btn.Click += CategoryButtonClick; } } }
private void addCategoryToolStripMenuItem_Click_1(object sender, EventArgs e) { AddCategory _AddCategory = new AddCategory(); _AddCategory.ShowDialog(); }