Hi all,
I added the printdialog component to my form. I created a button called "Print".
On the form, I have a multiline textbox. When I click on print, how do I instruct the printdialog to print the content of the multiline textbox. So far, it prints a blank page.
Below is my code of the print button:
Please help.
Thanks.
blumonde
PrivateWithEvents docToPrint AsNew Printing.PrintDocument
PrivateSub btPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btPrint.Click
Me.EPrintDialog.AllowSomePages = True
Me.EPrintDialog.AllowSelection = True
' Show the help button.
Me.EPrintDialog.ShowHelp = False
docToPrint.DocumentName = Me.mtxHelp.Text
Me.EPrintDialog.Document = docToPrint
Dim result As DialogResult = Me.EPrintDialog.ShowDialog()
' If the result is OK then print the document.
If (result = DialogResult.OK) Then
Me.docToPrint.Print()
EndIf
EndSub
I added the printdialog component to my form. I created a button called "Print".
On the form, I have a multiline textbox. When I click on print, how do I instruct the printdialog to print the content of the multiline textbox. So far, it prints a blank page.
Below is my code of the print button:
Please help.
Thanks.
blumonde
PrivateWithEvents docToPrint AsNew Printing.PrintDocument
PrivateSub btPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btPrint.Click
Me.EPrintDialog.AllowSomePages = True
Me.EPrintDialog.AllowSelection = True
' Show the help button.
Me.EPrintDialog.ShowHelp = False
docToPrint.DocumentName = Me.mtxHelp.Text
Me.EPrintDialog.Document = docToPrint
Dim result As DialogResult = Me.EPrintDialog.ShowDialog()
' If the result is OK then print the document.
If (result = DialogResult.OK) Then
Me.docToPrint.Print()
EndIf
EndSub
Last edited: