Forgive the begginer logic, but I can't afford a new degree until I get a raise.

Goal: To create a dynamic text search based on a bulleted style procedure.

Objective: Use a string reader to read a richtextbox line by line checking for the start and end of bullet points and outputting to prompt the end user to complete said step.

Problem: Extracting the text between bullet points with grace.

What I have so far:

Dim objReader As New System.IO.StringReader(ProcedureDisplay.CurrentTest.Text)
            Dim TextLine As String
            'Dim NextLine As String
            Dim BulletStartIndex As String
            Dim CurrentBullet As String
            BulletStartIndex = DocSearch.ProcedureFile.Text.IndexOf(ProcedureDisplay.CurrentTest.Text) - 3
            CurrentBullet = BulletStartIndex
            '**** Test ****
            'Dim BulletStart As Integer
            Do While objReader.Peek() <> -1
                TextLine = objReader.ReadLine
                CurrentBullet = Left(TextLine, 1)
                If CurrentBullet <> BulletStartIndex Then
                    ProcedureDisplay.CurrentStep.AppendText(TextLine + vbNewLine + "****")
                ElseIf CurrentBullet = BulletStartIndex Then
                    ProcedureDisplay.CurrentStep.AppendText(TextLine + vbNewLine + "9999")
                End If

This is how I would assume the logic should go.

For each line in Current test
        If "First2Characters" = "BulletStart" and  "ThirdCharacter"(does not increase) Then
        'Store line
        If "First2Characters" <> an Integer Then
        'Store Line
        If "ThirdCharacter"(does increase) then
        'retrieve Stored lines and output to msgbox

Hopefully I'm not too off base here, but I wouldn't be surprised.

Your logic seems Ok, but it's hard to tell for sure without a sample of the file. One thing, it appears that CurrentTest is a control, possibley a textbox or a listbox. Each of those contains the lines in a collection, the StringReader is somewhat redundant.

This article has been dead for over six months. Start a new discussion instead.