how to diassable the Printer processing window

K

Koen

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,

Koen
 
H

Herfried K. Wagner [MVP]

Koen said:
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)

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

Koen

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


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")

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top