int SttTang() { int dem = 0; int temp = 1; FormNguoiDat frmND = new FormNguoiDat(); dem = frmND.dgvNguoiDat.RowCount; if (dem == 0) { return(temp); } else { foreach (DataGridViewRow row in frmND.dgvNguoiDat.Rows) { if (temp < int.Parse(row.Cells[0].Value.ToString())) { temp = int.Parse(row.Cells[0].Value.ToString()); } } temp += 1; return(temp); } }
private void button4_Click(object sender, EventArgs e) { FormNguoiDat frm = new FormNguoiDat(); frm.Show(); }