VB.NET Read current line in a text area?

I have a text area and a function to do syntax highlighting on it. Right now it reads the entire RichTextBox. How would I get a string variable containing the current line? Below is the code i currently have.

Private Sub HighLight()
    Dim rm As System.Text.RegularExpressions.MatchCollection
    Dim m As System.Text.RegularExpressions.Match
    Dim x As Integer ''lets remember where the text courser was before we mess with it

    For Each pass In FrmColors.lb1.Items
        x = rtbMain.SelectionStart
        rm = System.Text.RegularExpressions.Regex.Matches(LCase(rtbMain.Text), LCase(pass))
        For Each m In rm
            rtbMain.Select(m.Index, m.Length)
            rtbMain.SelectionColor = Color.Blue
        rtbMain.Select(x, 0)
        rtbMain.SelectionColor = Color.Black
End Sub


Not tried it but:


if not assign the Lines property to an array and access the array element.

Need Your Help

Trying to add to an array

php codeigniter

I'm trying to pass along the question AND the id of the question in the first query and then with that id get that poll's options and add those to the array. Not seeing what I'm doing wronge here.

How can I make this code more efficient?

java android arrays imagebutton videoview

I'm making a Android app that basicically plays video from a website on the press of a button. As you can see by the code bellow I have 8 different buttons that will play eight different videos. I'...