private void addButton4_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 1) { FruitForm ff = new FruitForm(FruitTypeForm.MODE.ADD, Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value), (string)dataGridView1.SelectedRows[0].Cells[1].Value); if (ff.ShowDialog() == DialogResult.OK) { getFruit(); } } }
private void updateButton5_Click(object sender, EventArgs e) { if (dataGridView2.SelectedRows.Count == 1) { FruitForm ff = new FruitForm(FruitTypeForm.MODE.EDIT, Convert.ToInt32(dataGridView2.SelectedRows[0].Cells[0].Value), (string)dataGridView2.SelectedRows[0].Cells[1].Value, Convert.ToInt32(dataGridView2.SelectedRows[0].Cells[2].Value), (string)dataGridView2.SelectedRows[0].Cells[3].Value, (string)dataGridView2.SelectedRows[0].Cells[4].Value, (string)dataGridView2.SelectedRows[0].Cells[5].Value, (float)Convert.ToDouble(dataGridView2.SelectedRows[0].Cells[6].Value)); if (ff.ShowDialog() == DialogResult.OK) { getFruit(); } } }