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)
Form.RichTextBox.Select(String.IndexOf("Score: 5") - 1, Len("Score: 5"))
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
Public Sub SelectMyString() ' Create a string to search for the word "fox". Dim searchString As String = "fox" ' Determine the starting location of the word "fox". Dim index As Integer = Form.RichTextBox.IndexOf(searchString) ' Determine if the word has been found and select it if it was. If index != -1 Then 'Select the string using the index and the length of the string. Form.RichTextBox.Select(index, searchString.Length) End If End Sub