Styledtext Printer

I want to print styled text and I found the example code below, but it opens two printer dialogs. Is there a better way to do this?

Dim g As Graphics
Dim p As PrinterSetup
p = New PrinterSetup
If p.PageSetupDialog Then
g = OpenPrinterDialog§
If g <> Nil Then
g.DrawString(“Hello World”, 50, 50)
End If
End If

The first dialog sets up the printer, the second one actually sets up printing.

BTW next time you post code, please select it and click the code icon above the editor. It will be way more legible.

you could remove the call to PageSetupDialog function if you don’t need that.