private void Them() { try { frmXuLyDMTaiSan frm = new frmXuLyDMTaiSan(); frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); HienThi(); if (Ldata.Count != 0) { DataGridView.Rows[vtIndex == -1 ? 0 : (vtIndex >= Ldata.Count) ? Ldata.Count - 1 : vtIndex].Selected = true; //nếu ko có phần tử nào thì thôi } } catch (Exception ex) { MSG.Error(ex); } }
private void Sua() { try { if (vtIndex != -1) //khi click lên tiêu đề header của datagrid thì bỏ qua { frmXuLyDMTaiSan frm = new frmXuLyDMTaiSan(DataGridView.Rows[vtIndex]); frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); HienThi(); if (Ldata.Count != 0) { DataGridView.Rows[vtIndex == -1 ? 0 : (vtIndex >= Ldata.Count) ? Ldata.Count - 1 : vtIndex].Selected = true; //nếu ko có phần tử nào thì thôi } } } catch (Exception ex) { MSG.Error(ex); } }
private void Them() { try { frmXuLyDMTaiSan frm = new frmXuLyDMTaiSan(); frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); HienThi(); if (Ldata.Count != 0) DataGridView.Rows[vtIndex == -1 ? 0 : (vtIndex >= Ldata.Count) ? Ldata.Count - 1 : vtIndex].Selected = true; //nếu ko có phần tử nào thì thôi } catch (Exception ex) { MSG.Error(ex); } }
private void Sua() { try { if (vtIndex != -1) //khi click lên tiêu đề header của datagrid thì bỏ qua { frmXuLyDMTaiSan frm = new frmXuLyDMTaiSan(DataGridView.Rows[vtIndex]); frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); HienThi(); if (Ldata.Count != 0) DataGridView.Rows[vtIndex == -1 ? 0 : (vtIndex >= Ldata.Count) ? Ldata.Count - 1 : vtIndex].Selected = true; //nếu ko có phần tử nào thì thôi } } catch (Exception ex) { MSG.Error(ex); } }