Question Print from rich text box

doomslagen

Member
Joined
Mar 13, 2010
Messages
6
Programming Experience
1-3
I have a rich text box, "RichTextBox1", and a print document, "PrintDocument1". How do I connect the text box with the print document so that the print document is the text of the text box? I have already set up my print dialog, but I just haven't found how to set up the document yet. Please help me.
 
Re

This doesnt help me at all.

I have already set up all of that. I just need to set up the print document itself to work with the richtextbox. :mad:

Can someone please just give me a working example?
 
Both suggestions are working perfectly. Code samples are also given for both methods. In "plain text" article it says "We could use this class as follows:", in "rich text" article there is downloadable sample application.
 
What could be easier than using these two lines of code?
VB.NET:
Dim MyPrintObject As New TextPrint(RichTextBox1.Text)
MyPrintObject.Print()
The other one is equally simple, all you need is to load the project and press play to see it working. The PrintDocument code for that one includes about 10 lines of code and can be used in your own projects without modification.
 
thank you very much! I couldnt pick through the code to find that because it was too confusing. That is what I was trying to say!
 
Back
Top