private void btn_Add_Click(object sender, EventArgs e) { AE_Staff_Form ae_f = new AE_Staff_Form(0); ae_f.ShowDialog(); Load_dtgv(); if (Staff_dtgv.Rows.Count > 0) { Staff_dtgv.Rows[Staff_dtgv.Rows.Count - 1].Selected = true; } }
private void btn_Edit_Click(object sender, EventArgs e) { DataGridViewSelectedRowCollection r = Staff_dtgv.SelectedRows; if (r.Count == 1) { int index = Staff_dtgv.SelectedRows[0].Index; int id = Convert.ToInt32(Staff_dtgv.SelectedRows[0].Cells["id"].Value); AE_Staff_Form f = new AE_Staff_Form(id); f.ShowDialog(); Load_dtgv(); Staff_dtgv.Rows[index].Selected = true; } }
private void btn_Add_Click(object sender, EventArgs e) { AE_Staff_Form ae_f = new AE_Staff_Form(); ae_f.ShowDialog(); }