private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { string colName = dataGridView1.Columns[e.ColumnIndex].Name; if (colName == "colCancel") { formCancelDetails frm = new formCancelDetails(this); frm.txtID.Text = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); frm.txtTransNo.Text = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString(); frm.txtPCode.Text = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString(); frm.txtDesc.Text = dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString(); frm.txtPrice.Text = dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString(); frm.txtQty.Text = dataGridView1.Rows[e.RowIndex].Cells[6].Value.ToString(); frm.txtDiscount.Text = dataGridView1.Rows[e.RowIndex].Cells[7].Value.ToString(); frm.txtTotal.Text = dataGridView1.Rows[e.RowIndex].Cells[8].Value.ToString(); frm.txtCancel.Text = fpos.lblName.Text.Substring(0, fpos.lblName.Text.IndexOf(" |")); frm.ShowDialog(); } }
public formVoid(formCancelDetails frm) { InitializeComponent(); cn = new SqlConnection(dbCon.MyConnection()); fcancel = frm; }