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(); }
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(); } }