private void btnNew_Click(object sender, EventArgs e) { try { fEmployeeSalary frm = new fEmployeeSalary(); frm.ItemChanged = RefreshList; frm.ShowDlg(new EmpSalary()); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnEdit_Click(object sender, EventArgs e) { try { if (lsvEmpSalary.SelectedItems.Count <= 0) { MessageBox.Show("select an item to edit", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } EmpSalary oEmpSalary = null; fEmployeeSalary frm = new fEmployeeSalary(); if (lsvEmpSalary.SelectedItems != null && lsvEmpSalary.SelectedItems.Count > 0) { oEmpSalary = (EmpSalary)lsvEmpSalary.SelectedItems[0].Tag; } frm.ItemChanged = RefreshList; frm.ShowDlg(oEmpSalary); } catch (Exception ex) { MessageBox.Show(ex.Message); } }