0

I'm trying to build an user interface based on keywords from a text file. My search can now determine the index of each key word I apply. What I'd like to be able to do is then pull those indexes in numerical order from the textbox I saved them to.

I.E.

index value = 0
Do until "endoftextbox"
    'search textbox for next index value
    'Do something with this
Loop

Here is what I have so far,

    Sub ShallReadRoutine()
        Dim keywords() = {"shall read", "Power", "J-IC", "Factory Default"}
        Dim i As Integer
        For Each key As String In keywords


            i = Procedure.IndexOf(key)
            Do Until i = Procedure.LastIndexOf(key)
                RichTextBox1.AppendText(i)
                RichTextBox1.AppendText(" " + key)
                RichTextBox1.AppendText(Environment.NewLine)
                i = Procedure.IndexOf(key, i + 1)
            Loop
        Next key

    End Sub

Can someone help?

2
Contributors
1
Reply
20
Views
4 Years
Discussion Span
Last Post by tinstaafl
0

There is a Read-Only Lines Property that is an array of strings that represent the lines in the textbox. You should be able to iterate through that, something like this:

For I=0 to RichTextBox1.Lines.Length-1
    'Access the specific line like this, RichTextBox1.Lines(I)
    'And you can use the 'RichTextBox1.Lines(I).Contains("Some String")' method to see if a certain string is present
Next

Edited by tinstaafl

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.