Private Sub RichTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox.TextChanged
Dim source As String
Dim rtb As New RichTextBox ' name rtb as a RichText Box type
Dim Codearray() As String ' It's the array of text
Dim currentline As String ' The currentline of Text
Dim Line As Integer ' Dunno why I can't use somthing smaller ...
Dim I As Decimal 'Largestest thing
Codearray = Split(source, vbCrLf) ' split Code array from source at Center Left
For I = LBound(Codearray) To UBound(Codearray) 'From lower case to uppercase
currentline = Codearray(I) ' Code array for line
' add auto tab
Select Case Left() ' the left case
Case "\" ' comments
rtb.Text = currentline ' trb on current line
rtb.SelectedText = Len(currentline) ' select text
rtb.SelectionFont = New Font(rtb.SelectionFont, FontStyle.Italic) ' make her bold!
rtb.ForeColor() = Drawing.Color.Gray 'Change color
rtb.SelectedRtf = rtb.Text = Chr(10) & Chr(13)
Case "!" ' normal number
rtb.Text = currentline ' trb on current line
rtb.SelectedText = Len(currentline) ' select text
rtb.SelectionFont = New Font(rtb.SelectionFont, FontStyle.Strikeout) ' make her bold!
rtb.ForeColor() = Drawing.Color.Purple 'Change color
rtb.SelectedRtf = rtb.Text = Chr(10) & Chr(13)
Case "&" ' Literal
rtb.Text = currentline ' trb on current line
rtb.SelectedText = Len(currentline) ' select text
rtb.SelectionFont = New Font(rtb.SelectionFont, FontStyle.Regular) ' make her bold!
rtb.ForeColor() = Drawing.Color.Green 'Change color
rtb.SelectedRtf = rtb.Text = Chr(10) & Chr(13)
Case "%" ' Small number
rtb.Text = currentline ' trb on current line
rtb.SelectedText = Len(currentline) ' select text
rtb.SelectionFont = New Font(rtb.SelectionFont, FontStyle.Regular) ' make her bold!
rtb.ForeColor() = Drawing.Color.DarkRed 'Change color
rtb.SelectedRtf = rtb.Text = Chr(10) & Chr(13)
Case ""
rtb.Text = currentline ' trb on current line
rtb.SelectedText = Len(currentline) ' select text
rtb.SelectionFont = New Font(rtb.SelectionFont, FontStyle.Bold) ' make her bold!
rtb.ForeColor() = Drawing.Color.AntiqueWhite 'Change color
rtb.SelectedRtf = rtb.Text = Chr(10) & Chr(13)
Case "(" ' comments
rtb.Text = currentline ' trb on current line
rtb.SelectedText = Len(currentline) ' select text
rtb.SelectionFont = New Font(rtb.SelectionFont, FontStyle.Italic) ' make her bold!
rtb.ForeColor() = Drawing.Color.Bisque 'Change color
rtb.SelectedRtf = rtb.Text = Chr(10) & Chr(13)
Case ")" ' normal number
rtb.Text = currentline ' trb on current line
rtb.SelectedText = Len(currentline) ' select text
rtb.SelectionFont = New Font(rtb.SelectionFont, FontStyle.Strikeout) ' make her bold!
rtb.ForeColor() = Drawing.Color.Bisque 'Change color
rtb.SelectedRtf = rtb.Text = Chr(10) & Chr(13)
Case "{" ' Literal
rtb.Text = currentline ' trb on current line
rtb.SelectedText = Len(currentline) ' select text
rtb.SelectionFont = New Font(rtb.SelectionFont, FontStyle.Regular) ' make her bold!
rtb.ForeColor() = Drawing.Color.Brown 'Change color
rtb.SelectedRtf = rtb.Text = Chr(10) & Chr(13)
Case "}" ' Small number
rtb.Text = currentline ' trb on current line
rtb.SelectedText = Len(currentline) ' select text
rtb.SelectionFont = New Font(rtb.SelectionFont, FontStyle.Regular) ' make her bold!
rtb.ForeColor() = Drawing.Color.Brown 'Change color
rtb.SelectedRtf = rtb.Text = Chr(10) & Chr(13)
Case ":"
rtb.Text = currentline ' trb on current line
rtb.SelectedText = Len(currentline) ' select text
rtb.SelectionFont = New Font(rtb.SelectionFont, FontStyle.Bold) ' make her bold!
rtb.ForeColor() = Drawing.Color.Pink 'Change color
rtb.SelectedRtf = rtb.Text = Chr(10) & Chr(13)
If InStr(1, currentline, "(") > 0 Then
rtb.TabIndex = 1
Dim comment As Long
comment = InStr(InStr(1, currentline, ")"), currentline, "*")
rtb.SelectedRtf = rtb.SelectedRtf & Chr(10) & Chr(13)
End If
Case Else
rtb.Text = currentline ' trb on current line
rtb.SelectedText = Len(currentline) ' select text
rtb.SelectionFont = New Font(rtb.SelectionFont, FontStyle.Bold) ' make her bold!
rtb.BackColor() = Drawing.Color.Red 'Change color
rtb.SelectedRtf = rtb.Text = Chr(10) & Chr(13)
End Select
Next
End Sub