private void buttonAdd_Click(object sender, EventArgs e) { int ID = 10000; try { for (int i = 0; i < dGV1.RowCount; i++) { if (dGV1.Rows[i].Cells[0].Value != null) { ID = Math.Max(ID, Convert.ToInt32(dGV1.Rows[i].Cells[0].Value.ToString())); } } } catch (Exception ex) { } frmUserAdd fAdd = new frmUserAdd(nUserInfo, true, ID + 1, "", ""); fAdd.ShowDialog(); if (fAdd.DialogResult == System.Windows.Forms.DialogResult.OK) { FillGrid(); } }
private void buttonEdit_Click(object sender, EventArgs e) { frmUserAdd fAdd = new frmUserAdd(nUserInfo, false, sSelID, sSelName, sSelRole); fAdd.ShowDialog(); if (fAdd.DialogResult == System.Windows.Forms.DialogResult.OK) { FillGrid(); } }