printing two texts at with one click
Hello :wave:
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 :bigyello:
Re: printing two texts at with one click
VB Code:
if chk1 then RichTextBox1.SelPrint(Printer.hDC)
if chk2 then RichTextBox2.SelPrint(Printer.hDC)
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
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
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)
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)
Re: printing two texts at with one click
Yes gavio i tried exactly what you wrote
but it gives an error as i said
Re: printing two texts at with one click
Please zip up and attach your project.
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
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
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
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)
Re: printing two texts at with one click
Quote:
Are your richtextboxes either accidently or on purpose in a control array?
he say they are on different forms
Quote:
one is txtFileText in a form (main)
second is RichTextBox1 in a form (form1)
Re: printing two texts at with one click
While it's unlikely, they could still be parts of two different control arrays.
Re: printing two texts at with one click
Re: printing two texts at with one click
zip your project and post if you want someone to look at it
Re: printing two texts at with one click
Quote:
Originally Posted by om-yousif
so......
What does that mean?