private void saveEventButton_Click(object sender, EventArgs e) { DatabaseHandler db = new DatabaseHandler(); Event ev = new Event(); ev.Name = eventNameTB.Text; ev.Info = eventInfoRTB.Text; if (validateEvent(ev)) { db.saveEvent(ev); this.Close(); } else { MessageBox.Show(errorMessage); } }