Start New Discussion within our Software Development Community

Well, i really don't know, maybe the title would be in appropriate.

Here's my problem:

Textbox1.text =

abcd
sadsadasdas
dsad
as
das
d
1234

After parsing between abc and 1234
It shows sadsadasdasdsadasdasd

However it should also contain spaces.
Here's my piece of code:

Dim daniweb As String = TextBox1.Text


        Dim indexdaniwebstart As Integer = daniweb.IndexOf("abcd") + 4 '

        Dim indexdaniwebend As Integer = daniweb.IndexOf("1234")


        Dim danisoft As Integer = indexdaniwebend - indexdaniwebstart


        daniweb = daniweb.Substring(indexdaniwebstart, danisoft)

        Dim dani() As String = daniweb.Split(vbNewLine.ToCharArray)

        For Each line As String In dani 
            If Not line.StartsWith(" ") Then 
                If TextBox2.Lines.Length = 0 Then
                    TextBox2.Text &= line  
                Else
                    TextBox2.Text &= line
                End If
            End If
        Next

Shows something like this:
http://screensnapr.com/e/1VJFuu.png

It should display it like this:

sadsadasdas
dsad
as
das
d

Thanks

I'm confused with what you are expecting to see. Do you want the two textboxes to look the same without the first and last line or do you want it in a single line with a space between each value like this...

sadsadasdas dsad as das d

Either way, I think your problem is that lines 19 and 21 are identical. I'm guessing line 21 should include a vbnewline or a space.

TextBox2.Text &= vbnewline & line

or

TextBox2.Text &= " " & line

This question has already been answered. Start a new discussion instead.