If this has been asked before, sorry.
How can i set up different fonts in one RichTextBox using VB.NET? Because when i do this:
Dim String as String = "text" & vbCrLf & "more text"
Form.RichTextBox.Text = String
Form.RichTextBox.Select(String.IndexOf("Score: 5"), Len("Score: 5"))
Form.RichTextBox.SelectionFont = New Font(Presentatie.rtxtPresentatie.SelectionFont, FontStyle.Bold)
It will only make the “core: 5” part bold (tested this with selecting only, too, then it will only select the “core: 5” part).
Anyone help me? I need to get the answer very fast so please!
EDIT: Solved. Used this:
Form.RichTextBox.Select(String.IndexOf("Score: 5") - 1, Len("Score: 5"))
Thanks to codingbiz
I didn’t post my comment as answer because I was worried of when IndexOf returns 0, then -1 would throw an exception. So here is the solution from microsoft