private void cancel_btn_Click(object sender, EventArgs e) { DocNameUpdateEventArgs args = new DocNameUpdateEventArgs("enableAddPresButton"); DocNameUpdated(this, args); this.Dispose(); }
private void DocNameForm_ButtonClicked(object sender, DocNameUpdateEventArgs e) { thePrescribingDoc = e.getPrescibingDoc; /*if (thePrescribingDoc != "PRESdoc") * { * * } * else * { * MessageBox.Show("Sorry, Doctor Name Input Error!"); * }*/ string tapbs = e.getAddPresBtnStatus; if (tapbs == "enableAddPresButton") // cancel was pressed { addPrescription_btn.Enabled = true; //MessageBox.Show(tapbs); surname_cmb.Focus(); } else { patientDetails_grp.Enabled = false; stockTable_grp.Visible = true; drugsDispensed_grp.Visible = true; loadProductTable(); //MessageBox.Show(thePrescribingDoc); } }
// this button click event handler will raise the event which can then intercepted by any // listeners // read the textboxes and set the variables private void done_btn_Click(object sender, EventArgs e) { string presDoc = presDocName_txt.Text; // form validation // if empty > if (string.IsNullOrEmpty(presDoc)) { MessageBox.Show("~ please provide name of doctor that issued this prescription", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); presDocName_txt.Focus(); return; } DialogResult result = MessageBox.Show("Proceed to Add Drugs?", "Doctor Name Entry", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { // instance the event args and pass it each value DocNameUpdateEventArgs args = new DocNameUpdateEventArgs(presDoc); // raise the event with the updated arguments DocNameUpdated(this, args); this.Dispose(); } }