Dim PJ As PrinterJob = PrinterJob_Static.CreatePrinterJob
If PJ.ShowPrintDialog(Null)=False Or PJ.ShowPageSetupDialog(Null)=False Then ' This is line 76 of the code module, looks like PJ is not accessible
PJ.CancelJob
Return
End If
Dim PA As Paper
PA.Initialize()
PA = Paper_static.A4
Dim Pr As Printer = GetPrinter(PJ.GetPrinter.GetName)
Dim PL As PageLayout
PL.Initialize()
PL = Pr.CreatePageLayout2(PA, PageOrientation_Static.LANDSCAPE, "DEFAULT")
PJ.PrintPage2(PL, myMainForm.RootPane) 'For long way
PJ.EndJob