private void btnView_Click(object sender, EventArgs e) { int id; try{ id = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.GetSelectedRows()[0], gridView1.Columns[0])); } catch { id = 0; MessageBox.Show("Error."); return; } var formEditContact = new frmEditContract(this, "View", id); formEditContact.Show(this); }
private void btnAdd_Click(object sender, EventArgs e) { var formEditContact = new frmEditContract(this, "New", 0); formEditContact.Show(this); }