private void btnAdd_Click(object sender, EventArgs e) { Client cl = new Client(); ManageClientInfo form = new ManageClientInfo(cl); form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { try { cl.ApplyChange(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Не удалось сохранить данные."); cl = null; } } UpdateListClients(); }
private void btnChange_Click(object sender, EventArgs e) { Client cl = (Client)lstClients.SelectedItem; if (cl == null) return; ManageClientInfo form = new ManageClientInfo(cl); form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { try { cl.ApplyChange(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Не удалось сохранить данные."); cl = null; } } UpdateListClients(); }