private void frmAddPatient_Load(object sender, EventArgs e) { //fills the state combo box cboState.DataSource = StateManager.getStates(); cboState.DisplayMember = "abbreviation"; cboState.ValueMember = "abbreviation"; }
private void frmPatientPrescription_Load(object sender, EventArgs e) { try { //fills the state combo box cboState.DataSource = StateManager.getStates(); cboState.DisplayMember = "abbreviation"; cboState.ValueMember = "abbreviation"; //gets the patient ID from the previous form myPatientID = frmSearchPrescriptions.myID; //fills the boxes with current patient information PharmacyDataTier aPharm = new PharmacyDataTier(); DataSet ds = new DataSet(); ds = aPharm.GetPatient("", "", myPatientID); if (ds.Tables[0].Rows.Count > 0) { txtPatientID.Text = ds.Tables[0].Rows[0]["Patient ID"].ToString().Trim(); txtFName.Text = ds.Tables[0].Rows[0]["First Name"].ToString().Trim(); txtMInit.Text = ds.Tables[0].Rows[0]["Middle Initial"].ToString().Trim(); txtLName.Text = ds.Tables[0].Rows[0]["Last Name"].ToString().Trim(); dtpDOB.Value = DateTime.Parse(ds.Tables[0].Rows[0]["Date of Birth"].ToString().Trim()); cboGender.Text = ds.Tables[0].Rows[0]["Gender"].ToString().Trim(); txtStreet1.Text = ds.Tables[0].Rows[0]["Street 1"].ToString().Trim(); txtStreet2.Text = ds.Tables[0].Rows[0]["Street 2"].ToString().Trim(); txtCity.Text = ds.Tables[0].Rows[0]["City"].ToString().Trim(); cboState.SelectedValue = ds.Tables[0].Rows[0]["State"].ToString().Trim(); txtZip.Text = ds.Tables[0].Rows[0]["zip"].ToString().Trim(); txtHomePhone.Text = ds.Tables[0].Rows[0]["Home Phone"].ToString().Trim(); txtWorkPhone.Text = ds.Tables[0].Rows[0]["Work Phone"].ToString().Trim(); txtCellPhone.Text = ds.Tables[0].Rows[0]["Cell Phone"].ToString().Trim(); txtEmail.Text = ds.Tables[0].Rows[0]["Email"].ToString().Trim(); } //fills the datagrid UpdatePrescriptionDGV(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }