mharley
November 23rd, 2004, 03:38 PM
I am trying to print the contents of a text box, and while I can get the program to activate the printer and feed paper, nothing gets printed on the paper. This is because I don't know how to send the contents of the text box to the printdocument. I'll post the code below:
Dim textToPrint As String = txtData.Text
Dim textPrint As New PrintDialog()
Dim objPrintDocument As PrintDocument = New PrintDocument()
objPrintDocument.DocumentName = "Journal"
textPrint.AllowPrintToFile = False
textPrint.AllowSomePages = False
textPrint.Document = objPrintDocument
If textPrint.ShowDialog = DialogResult.OK Then
objPrintDocument.PrinterSettings = textPrint.PrinterSettings
objPrintDocument.Print()
End If
What am I missing? Any help is appreciated.
Dim textToPrint As String = txtData.Text
Dim textPrint As New PrintDialog()
Dim objPrintDocument As PrintDocument = New PrintDocument()
objPrintDocument.DocumentName = "Journal"
textPrint.AllowPrintToFile = False
textPrint.AllowSomePages = False
textPrint.Document = objPrintDocument
If textPrint.ShowDialog = DialogResult.OK Then
objPrintDocument.PrinterSettings = textPrint.PrinterSettings
objPrintDocument.Print()
End If
What am I missing? Any help is appreciated.