private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { ID = Convert.ToInt16(dataGridView1.CurrentRow.Cells[0].Value); Date = dataGridView1.CurrentRow.Cells[1].Value.ToString(); Item = dataGridView1.CurrentRow.Cells[2].Value.ToString(); Loc = dataGridView1.CurrentRow.Cells[3].Value.ToString(); Quantity = Convert.ToInt16(dataGridView1.CurrentRow.Cells[4].Value); Type = dataGridView1.CurrentRow.Cells[5].Value.ToString(); if (e.ColumnIndex == 6) { type = "Edit"; Add_StockAdjusment aj = new Add_StockAdjusment(); aj.Text = "Edit"; aj.ShowDialog(); initialize(); } if (e.ColumnIndex == 7) { if (DialogResult.Yes == MessageBox.Show("Do You Want Delete ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) { i.DeleteAdjustment(Convert.ToInt16(dataGridView1.CurrentRow.Cells[0].Value)); } initialize(); } }
private void Save_button_Click(object sender, EventArgs e) { type = "Add"; Add_StockAdjusment aj = new Add_StockAdjusment(); aj.Text = "Add"; aj.ShowDialog(); initialize(); }