Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hi i have a problem with rich text box formatting. It seems when I format the current text, the previous text that i've formatted goes unformatted. Here's the code:

       MainBox.Find((UserName.Text & ": "), RichTextBoxFinds.Reverse)
       Dim fntrb As New Font(MainBox.Font, FontStyle.Bold)
       MainBox.SelectionFont = fntrb
       MainBox.SelectionColor = Color.Red

 

So if I have several lines with each one beginning with UserName.Text, each time the line is entered it is supposed to format that part. The problem is after it formats that part the previous lines become unformatted, which I don't want to happen.

To err is human, to really foul things up requires a computer.
  • *Experts*
Posted
If you are setting the Text properly directly, that is why. If you want existing text to retain its formatting, you will need to use the SelectedText property to append text.
With RichTextBox1
 .SelectionStart = .Text.Length
 .SelectedText = "Some Text to Append"
 'format the stuff here
End With

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...