private void EditContact() { var item = GetSelectedContact(); if (item == null) { return; } var form = new ContactForm(); form.Text = "Edit Contact"; form.Contact = item; if (form.ShowDialog(this) == DialogResult.Cancel) { return; } _database.Edit(item.Name, form.Contact); RefreshContacts(); }