private void buttonedit_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex == -1) { MessageBox.Show("please Select an entry first"); } if (listBox1.SelectedIndex >= 0) { int index = listBox1.SelectedIndex; var form = new FormCpyDetail(Dc, _cpyList[index], _allPersonList, _glist); form.ShowDialog(); RefreshListbox(); } }
private void buttoninsert_Click(object sender, EventArgs e) { Company newCompany = new Company(); FormCpyDetail form = new FormCpyDetail(Dc, newCompany, _allPersonList, _glist); form.ShowDialog(); if (_cpyList == null) { return; } else { _cpyList.Add(newCompany); RefreshListbox(); } }