Exemplo n.º 1
0
        private void btnViewProduct_Click(object sender, EventArgs e)
        {
            // index row đang được chọn
            int           rowindex = dataGridViewProduct.CurrentCell.RowIndex;
            List <string> product  = new List <string>();

            foreach (DataGridViewCell cell in dataGridViewProduct.Rows[rowindex].Cells)
            {
                product.Add(cell.Value.ToString());
            }
            EditProduct editProductForm = new EditProduct(product, false);

            editProductForm.ShowDialog();
        }
Exemplo n.º 2
0
        private void btnEditProduct_Click(object sender, EventArgs e)
        {
            // index row đang được chọn
            int           rowindex = dataGridViewProduct.CurrentCell.RowIndex;
            List <string> product  = new List <string>();

            //int columnindex = dataGridViewProduct.CurrentCell.ColumnIndex;
            //MessageBox.Show(dataGridViewProduct.Rows[rowindex].Cells[columnindex].Value.ToString());
            foreach (DataGridViewCell cell in dataGridViewProduct.Rows[rowindex].Cells)
            {
                product.Add(cell.Value.ToString());
            }
            EditProduct editProductForm = new EditProduct(product, true);

            if (editProductForm.ShowDialog() == DialogResult.OK)
            {
                loadDataGridViewProduct();
            }
        }