all groups > vb.net > january 2008 >
You're in the

vb.net

group:

how to diassable the Printer processing window


how to diassable the Printer processing window Koen
1/31/2008 4:11:40 PM
vb.net:
Hello,

Is there a way to print a page without that the printer
processingdialogbox appears. I don't mean the Printer Dialog Box but
the box that comes up when the page is sent to the printer. (The
Dialog box who comes up has in the Title: Printing... at the prompt:
Page 1 of Document)

Greatings,

Re: how to diassable the Printer processing window Herfried K. Wagner [MVP]
1/31/2008 4:23:42 PM
"Koen" <remove_info@tendence.be> schrieb:
[quoted text, click to view]

Assign 'StandardPrintController' or a custom 'PrintController' object to the
'PrintDocument' object's 'PrintController' property. By default
'PrintControllerWithStatusDialog' is used.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Re: how to diassable the Printer processing window Koen
1/31/2008 6:30:30 PM
On Thu, 31 Jan 2008 16:23:42 +0100, "Herfried K. Wagner [MVP]"
[quoted text, click to view]


Thanks Herfried,
I made this code to do the job, it's a combination of several codes I
found. I'm new to dot net...

Greatings,
koen

Public Class myPrinter

Friend TextToBePrinted As String

Private Sub PrintPageHandler(ByVal sender As Object, _
ByVal args As Printing.PrintPageEventArgs)
Dim myFont As New Font("Microsoft San Serif", 10)
args.Graphics.DrawString(TextToBePrinted, _
New Font(myFont, FontStyle.Regular), _
Brushes.Black, 0, 0)
End Sub

Public Sub My_Print(ByVal text As String)
TextToBePrinted = text

Dim m_PrintDocument As New Printing.PrintDocument

Using (m_PrintDocument)
Dim printControl As New Printing.StandardPrintController
m_PrintDocument.PrinterSettings.PrinterName =
"Printername"


AddHandler m_PrintDocument.PrintPage, AddressOf
Me.PrintPageHandler
m_PrintDocument.PrintController = printControl

m_PrintDocument.Print()
RemoveHandler m_PrintDocument.PrintPage, AddressOf
Me.PrintPageHandler
End Using

End Sub

'Create a button on a form

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Dim Print As New myPrinter

Print.My_Print("This is a test" & vbLf & "Without the Status
window")

AddThis Social Bookmark Button