I have am wanting to populate my form fields on form load. One of these fields is a picturebox. I am passing the imagelocation to the pb on load. At the end of the load event I am calling my printForm() which prints the form. For some reason, the image only shows up in the print preview if I run the printForm() on a button click instead of at the end of the load. I have tried to run it on form_shown and form_closing. It fails to display. Any ideas on what I am doing wrong?
Code:Public Sub printForm() With Me.PrintForm1 .PrinterSettings.DefaultPageSettings.Margins.Left = 0.05 .PrinterSettings.DefaultPageSettings.Margins.Top = 0.05 .PrintAction = PrintAction.PrintToPreview .Print(Me, PowerPacks.Printing.PrintForm.PrintOption.ClientAreaOnly) End With Me.Close() End Sub Private Sub frmReceipt_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load gInvId = "12345" gTTime = "12:45:56" gTDate = "07/17/2012" gCustId = "602010" gCSubId = "000" gCust = "Customer" gAcctId = "*1234" gTotal = "$27.56" gImgLoc = "C:\SigImages\test1.bmp" Timer1.Enabled = False lblInvNo.Text = gInvId lblTrnTim.Text = gTTime lblTrnDat.Text = gTDate lblTrnCu.Text = gCustId & gCSubId lblTrnCus.Text = gCust lblAcctNo.Text = gAcctId lblInvAmt.Text = gTotal pbSig.ImageLocation = gImgLoc printForm() End Sub




Reply With Quote
