private void send_email_button_Click(object sender, EventArgs e) { string query = "select * from d_active where employeenumber = '" + this.employee_box_name + "' and len(emailaddress) > 4 and len(SMTP) > 4 "; ExcoODBC database = ExcoODBC.Instance; OdbcDataReader reader; database.Open(Database.DECADE_MARKHAM); reader = database.RunQuery(query); reader.Read(); // Diagnose whether or not user has email settings set up; if not, prompt setup window instead try { string email = reader[3].ToString().Trim(); SendEmail email_client = new SendEmail(this.employee_box_name, email); email_client.Show(); reader.Close(); } catch { reader.Close(); EmailSettings email_settings = new EmailSettings(employee_box_name); email_settings.Show(); } }