Esempio n. 1
0
        private void Save_Click(object sender, EventArgs e)
        {
            if (ValidateChildren())
            {
                //Adding Rows
                DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[0].Clone();
                row.Cells[0].Value = NameBox.Text;
                row.Cells[1].Value = PriceBox.Text;
                row.Cells[2].Value = CategoryBox.Text;
                row.Cells[3].Value = BrandBox.Text;
                row.Cells[4].Value = ColorBox.Text;
                row.Cells[5].Value = BarcodeBox.Text;
                row.Cells[6].Value = StockBox.Text;
                row.Cells[7].Value = AdBox.Text;
                dataGridView1.Rows.Add(row);

                NameBox.Clear();
                PriceBox.Clear();
                ColorBox.Clear();
                StockBox.Clear();
                BarcodeBox.Clear();
                AdBox.Clear();
            }
            else
            {
                MessageBox.Show("Please fill form correctly,then save!");
            }
        }