|
-
Oct 5th, 2006, 04:50 AM
#1
Thread Starter
Addicted Member
printing two texts at with one click
Hello
how can i print two richtexts using only one click buttun
i have to let user decide if he wants to print one of the texts or both by a check box
once he choose the text or texts and click (print) they should be printed in the same format and color of the original texts and in saparate papers
thanks all
-
Oct 5th, 2006, 05:20 AM
#2
Re: printing two texts at with one click
VB Code:
if chk1 then RichTextBox1.SelPrint(Printer.hDC)
if chk2 then RichTextBox2.SelPrint(Printer.hDC)
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 5th, 2006, 06:44 AM
#3
Thread Starter
Addicted Member
Re: printing two texts at with one click
it gives an error
(Method or data member not found)
and points to (.SelPrint)
should i add something from components
-
Oct 5th, 2006, 07:15 AM
#4
Re: printing two texts at with one click
what is the name of your rich text controls?
or are you trying to print .rtf files, if you want to print files, you will need to use shellexecute to use the associated program (normally ms word, but if word not installed then wordpad) to print the file
alternativly you can load the file contents into a rich text control then use the selprint method
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 5th, 2006, 04:28 PM
#5
Thread Starter
Addicted Member
Re: printing two texts at with one click
actually they r not files
they r two normal richtexts in two different forms
one is txtFileText in a form (main)
second is RichTextBox1 in a form (form1)
-
Oct 5th, 2006, 04:30 PM
#6
Re: printing two texts at with one click
Try this:
VB Code:
if chk1 then [B]main.txtFileText[/B].SelPrint(Printer.hDC)
if chk2 then [B]form1.RichTextBox1[/B].SelPrint(Printer.hDC)
-
Oct 5th, 2006, 05:23 PM
#7
Thread Starter
Addicted Member
Re: printing two texts at with one click
Yes gavio i tried exactly what you wrote
but it gives an error as i said
-
Oct 5th, 2006, 07:55 PM
#8
Re: printing two texts at with one click
Please zip up and attach your project.
-
Oct 6th, 2006, 07:01 AM
#9
Re: printing two texts at with one click
is txtfiletext a text box, or richtextbox?
you can't use selprint on a standard text box
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 7th, 2006, 07:25 AM
#10
Thread Starter
Addicted Member
Re: printing two texts at with one click
they are richtext boxes
simplly there is two forms each with a different richtext box and i need to let the user to choose if he want to print one of them or both by a checkbox
i mean:
print form should include:
checkbox 1 is for the first text
checkbox 2 for the second
and one print button
-
Oct 7th, 2006, 07:42 AM
#11
Re: printing two texts at with one click
well the selprint should work, as you have posted no code or any example i am unable to help any further
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 7th, 2006, 11:27 AM
#12
Re: printing two texts at with one click
Are your richtextboxes either accidently or on purpose in a control array? (You can check by looking at the Index property which will be 0 or greater if they are). If so then you need to do something like
VB Code:
if chk1 then RichTextBox(0).SelPrint(Printer.hDC)
if chk2 then RichTextBox(1).SelPrint(Printer.hDC)
-
Oct 7th, 2006, 05:53 PM
#13
Re: printing two texts at with one click
Are your richtextboxes either accidently or on purpose in a control array?
he say they are on different forms
one is txtFileText in a form (main)
second is RichTextBox1 in a form (form1)
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 7th, 2006, 06:10 PM
#14
Re: printing two texts at with one click
While it's unlikely, they could still be parts of two different control arrays.
-
Oct 8th, 2006, 05:26 AM
#15
Thread Starter
Addicted Member
Re: printing two texts at with one click
-
Oct 8th, 2006, 05:37 AM
#16
Re: printing two texts at with one click
zip your project and post if you want someone to look at it
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 8th, 2006, 10:21 AM
#17
Re: printing two texts at with one click
 Originally Posted by om-yousif
so......
What does that mean?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|