Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print contents of textbox

Status
Not open for further replies.

buddyel

MIS
Mar 3, 2002
279
US

I have a multi-line textbox that displays a row of data from a SELECT query. How can I get this text to printout. Do I need to add the printdialog and printdocument to the form, or can i do it all with code??
 
Hello buddyel,
I am afraid that you need to use the PrintDocument to print the text.

Camel
 

Ok, do you what the code is to have (txtOut.text) to be the printdocument value?


 
Hello buddyel,
In order to print the text you need to add a printdocument object on your form. then you need to add the following:

----------------- PrintDocument1.PrintPage -------------

Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
e.Graphics.DrawString(txtOut.text, New Font("Arial", 20), Brushes.Black, 10, 10)
End Sub


and also add PrintDocument1.Print() where you want to print the text

hope that helps,
Camel
 
hi, how about i need to print an entire form. Because the program im working on is connect to database. that is why there is no variable or anything. In this program, i have two table, one on the main form and the other one is at the detail form..Would you please tell me how can i create a button which can print the whole document
thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top