private void btnAdd_Click(object sender, EventArgs e) { try { EPV.SetError(cboDrug, ""); EPV.SetError(cboPhysicianID, ""); string physicianID = cboPhysicianID.SelectedValue.ToString(); try { //get the values string NDCPackageCode = cboDrug.SelectedValue.ToString(); string totalRefills = txtRefill.Text.Trim(); DateTime time = dtpDatePrescribed.Value; //Send it throug the datatier PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.AddPrescription(NDCPackageCode, myPatientID, physicianID, totalRefills, time); MessageBox.Show("Prescription succesfully added.", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception) { EPV.SetError(cboDrug, "must select a drug from the list"); MessageBox.Show("Must select a drug in the list.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception) { EPV.SetError(cboPhysicianID, "Must select a physician from the list"); MessageBox.Show("Must select a physician in the list.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }