Board index » Visual Studio » rich textbox loses formatting when printed to from 2 different subs
|
hox
|
|
hox
|
rich textbox loses formatting when printed to from 2 different subs
Visual Studio6
I'm using a rich textbox to let the user enter a few lines of text and format them (font family, font size, italic, bold, color, underline). Then I print a report to the rich textbox from a different sub on a different form. When I do the textbox loses all of its formatting except what was on the last line of the heading, and it applies that to the whole textbox contents. Is there a trick to this? TIA Mike - |
| Ken
Registered User |
Thu Apr 27 12:56:49 CDT 2006
Re:rich textbox loses formatting when printed to from 2 different subs
"Mike Scirocco" <mscir@yahoo.com>wrote in message
QuoteI'm using a rich textbox to let the user enter a few lines of text and something like.... '========== Public Sub AddSomeText(Text2Add As String, Optional AddCR As Boolean = True) With RichTextBox1 'place the cursor at the end of all text .SelStart = Len(.TextRTF) 'add the new text .SelText = Text2Add 'optionally, add a cr/lf If AddCR Then .SelText = vbCrLf End If End With End Sub '========== If you're using 'RichTextBox1.Text = RichTextBox1.Text & MoreText', you won't be able to control formatting. -- Ken Halter - MS-MVP-VB - Please keep all discussions in the groups.. DLL Hell problems? Try ComGuard - www.vbsight.com/ComGuard.htm">www.vbsight.com/ComGuard.htm - |
| Rick
Registered User |
Thu Apr 27 13:00:17 CDT 2006
Re:rich textbox loses formatting when printed to from 2 different subsQuoteI'm using a rich textbox to let the user enter a few lines of text and or a normal TextBox (see your sentence starting with "When I do the textbox loses...")? Also, it would have been helpful if you had provided some code so we wouldn't have to guess at what you are doing. Anyway, assuming you are moving the contents of one RichTextBox to another RichTextBox, are you assigning the Text property to the Text property or the TextRTF property to the TextRTF property (which is what I think you may want)? Rick - |
| Rick
Registered User |
Thu Apr 27 13:09:00 CDT 2006
Re:rich textbox loses formatting when printed to from 2 different subsQuoteIf you're using 'RichTextBox1.Text = RichTextBox1.Text & MoreText', RichTextBox2.SelRTF = RichTextBox1.TextRTF Rick - |
| Mike
Registered User |
Thu Apr 27 17:20:06 CDT 2006
Re:rich textbox loses formatting when printed to from 2 different subs
Rick Rothstein wrote:
<snip> QuotePrint? To a RichTextBox? the code suggestions, thanks. Mike - |
