private void SaveButton_Click(object sender, EventArgs e) { if (isValidated()) { ContactManagerrr cm = new ContactManagerrr(); cm.setName(NametextBox.Text.Trim()); cm.setEmail(EmailtextBox.Text.Trim()); cm.setSubject(SubjecttextBox.Text.Trim()); cm.SetMessage(MessagetextBox.Text.Trim()); ContactManagerUi.messages.Add(cm); MessageBox.Show("Email Sent", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); ResetForm(); this.Close(); } }
private void Savebutton_Click(object sender, EventArgs e) { if (isValidated()) { ContactManagerrr cm = new ContactManagerrr(); cm.setName(NametextBox.Text.Trim()); cm.setEmail(EmailtextBox.Text.Trim()); if (!isEdit) { ContactManagerUi.instances.Add(cm); MessageBox.Show("All Data Saved", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (isEdit) { ContactManagerUi.instances[indextoedit] = cm; } ResetForm(); this.Close(); } }