Printing

blumonde

Well-known member
Joined
Jul 26, 2005
Messages
68
Programming Experience
Beginner
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

 
Last edited:
kulrom said:
take a look at this thread http://www.vbdotnetforums.com/showthread.php?t=4770&highlight=print

there is an exmaple of how to print (as i pointed out uncoment the print to get content out


Cheers ;)


Hi Kulrom,

I downloaded the zip file and read the Printoutform.vb. However, I still don't know how to make it to print the multiline textbox on the form. I am not printing a physical file. Just want to tell the print function to print what is display in the textbox. Do you have an example like that for me ?

Cheers,

blumonde
 
catch this
palec.gif



Cheers ;)
 

Attachments

  • PrintText.zip
    29.7 KB · Views: 56
Back
Top