private void frmPrintLabel_Load(object sender, EventArgs e) { try { new clsCssStyle().setStyle((Control)this); int y = 0; this.pnlusercontrol.AutoScroll = true; foreach (DataRow dataRow in (InternalDataCollectionBase)GblIQCare.dtPrintLabel.Rows) { UserPrintControl userPrintControl = new UserPrintControl(); userPrintControl.Name = "wucpnl" + dataRow["ItemId"].ToString(); userPrintControl.Location = new Point(this.pnlusercontrol.Location.X, y); userPrintControl.Facility.Text = GblIQCare.AppLocation + " Tel:" + GblIQCare.AppLocTelNo; userPrintControl.Store.Text = GblIQCare.StoreName + " " + GblIQCare.CurrentDate; userPrintControl.PatientName.Text = GblIQCare.PatientName.ToUpper(); userPrintControl.chkDName.Text = dataRow["ItemName"].ToString(); userPrintControl.lbldrugquantity.Text = dataRow["qtydisp"].ToString() + " " + dataRow["DispensingUnitName"].ToString() + " Exp:" + dataRow["ExpiryDate"].ToString(); userPrintControl.txtInstruction.Text = dataRow["PatientInstructions"].ToString(); this.pnlusercontrol.Controls.Add((Control)userPrintControl); y = y + userPrintControl.Height + 25; } } catch (Exception ex) { MsgBuilder MessageBuilder = new MsgBuilder(); MessageBuilder.DataElements["MessageText"] = ex.Message.ToString(); int num = (int)IQCareWindowMsgBox.ShowWindowConfirm("#C1", MessageBuilder, (Control)this); } }
//Each label loaded separately. private void frmPrintLabel_Load(object sender, EventArgs e) { try { clsCssStyle theStyle = new clsCssStyle(); theStyle.setStyle(this); int locY = 0; pnlusercontrol.AutoScroll = true; DataTable theDT = GblIQCare.dtPrintLabel; foreach (DataRow theDR in theDT.Rows) { UserPrintControl myCtrl = new UserPrintControl(); myCtrl.Name = "wucpnl" + theDR["ItemId"].ToString(); myCtrl.Location = new Point(pnlusercontrol.Location.X, locY); myCtrl.Facility.Text = GblIQCare.AppLocation + " Tel:" + GblIQCare.AppLocTelNo; myCtrl.Store.Text = GblIQCare.StoreName + " " + GblIQCare.CurrentDate; myCtrl.PatientName.Text = GblIQCare.PatientName.ToUpper(); myCtrl.chkDName.Text = theDR["ItemName"].ToString(); myCtrl.lbldrugquantity.Text = theDR["qtydisp"].ToString() + " " + theDR["DispensingUnitName"].ToString() + " Exp:" + theDR["ExpiryDate"].ToString(); myCtrl.txtInstruction.Text = theDR["PatientInstructions"].ToString(); pnlusercontrol.Controls.Add(myCtrl); locY = locY + myCtrl.Height + 25; } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }