private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { JournalID = Convert.ToInt16(dataGridView1.CurrentRow.Cells[1].Value); AccountTitle = dataGridView1.CurrentRow.Cells[2].Value.ToString(); VoucherID = Convert.ToInt16(dataGridView1.CurrentRow.Cells[3].Value); VoucherIndex = Convert.ToInt16(dataGridView1.CurrentRow.Cells[4].Value); CR = dataGridView1.CurrentRow.Cells[6].Value.ToString(); DR = Convert.ToDecimal(dataGridView1.CurrentRow.Cells[7].Value.ToString()); Description = dataGridView1.CurrentRow.Cells[8].Value.ToString(); if (e.ColumnIndex == 9) { type = "Edit"; add_Debit aj = new add_Debit(); aj.Text = "Edit"; aj.ShowDialog(); initialize(); } if (e.ColumnIndex == 10) { if (DialogResult.Yes == MessageBox.Show("Do You Want Delete ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) { Journal.DeleteJournal(Convert.ToInt16(dataGridView1.CurrentRow.Cells[3].Value)); } initialize(); } }
private void Update_button_Click(object sender, EventArgs e) { type = "Add"; add_Debit aj = new add_Debit(); aj.Text = "Add"; aj.ShowDialog(); initialize(); }