Solved

Print from Rich Text Box

Posted on 1998-10-04
14
298 Views
Last Modified: 2010-04-30
Dear Experts,
 
     I have a form that has text boxes on top and 2 rich text boxes below. I am trying to print them so that they look exactly like what they look like on screen. Except that the scrollable part in the rich text boxes must also print out. So print form is out.

     What I realised is that when I user richtextbox1.selprint printer.hdc it always start from currentx=0 currenty=0. How can I print the textboxes(like name and address information) first(on top part of page) and print the rich text boxes following below them. I need to use SelPrint because it is the only way to preserve the text formatting I have in the rich text boxes.

    Any takers? Thanks!!

Cheers,
Ching Ping
0
Comment
Question by:chingping
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
14 Comments
 

Author Comment

by:chingping
ID: 1438031
Edited text of question
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1438032
Create a picture box. Use .SelPrint Pic1.hdc, and then use PaintPicture to put the picture box's contents whereever you need
0
 

Author Comment

by:chingping
ID: 1438033
Dear MikeP,
     
      I don't really understand what you are talking about. Can you kindly elaborate a little?

Regards,
Ching Ping
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:chingping
ID: 1438034
Dear MikeP,

     Also on my forms there are checkboxes. How can I print them out together with the Rich Text Boxes and text boxes?

Regards,
Ching Ping
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1438035
Create a picturebox, name in Picture1
Use this code:
Rtf1.SelPrint Picture1.hDc
Printer.PaintPicture picture1.picture, x, y

About the checkboxes, you can place them into a picture box as well, and then use the same method of PaintPicture
0
 

Author Comment

by:chingping
ID: 1438036
Dear MikeP,

     Also on my forms there are checkboxes. How can I print them out together with the Rich Text Boxes and text boxes?

Regards,
Ching Ping
0
 

Author Comment

by:chingping
ID: 1438037
Dear MikeP,

     The first line executed alright
        RichTextBox1.SelPrint Form1.Picture1.hdc
        Printer.PaintPicture Picture1.Picture, 1440, 1440
        Printer.EndDoc

     It bombed at the second line.
     Runtime error '481' Invalid picture.

     Something weird is happening, I cannot get Picture1.hDc
     It always revert me to Picture1.hdc

     Has it anything to do with that?


0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1438038
hmm, try Picture1.Image

the case of hDC doesn't matters, vb isn't case sensetice
0
 

Author Comment

by:chingping
ID: 1438039
Dear MikeP,

     Yes picture1.image does not have error but it prints out a grey box. The same size as that shown on screen. If I make the picture box larger the printed grey box will be equally large with the same shape but has got no words in it although I can see the RTF words in the picture box control
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1438040
Try setting .AutoRedraw to True on the picturebox
0
 

Author Comment

by:chingping
ID: 1438041
Dear MikeP,

     It finallt did print out. But as what I had mentioned it only prints out the part equivalent to the size of the picturebox.
     Even if it works, I can use RTB.selprint directly. Unless I can insert text in the picturebox before the RTF and after the RTF right?
     HOw can I combine all! textboxes, RTboxes and checkboxes to print out?

0
 

Accepted Solution

by:
happydanny earned 100 total points
ID: 1438042
Dear Ching Ping,

     I can mail you the solution. Email your address to happydanny@hotmail.com

Regards,
Dan
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1438043
Bought This Question.
0
 

Expert Comment

by:jawad_hussain
ID: 2209664
I bought this question too.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Macro Excel - Multiple If conditions 2 88
Child Form in front 4 57
adding "ungroup sheets" to existing vbs code 5 57
Assign a value in Excel V-Basic 3 29
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question