Hello Guyz
Need some more help now.
This is my GUI
[img]http://screensnapr.com/e/AuJ8Ka.png[/img]

Suppose i have this written in textbox1

vb.net
gettext
leaning daniweb.com 2 learn
vb2learn

[img]http://screensnapr.com/e/sC969O.png[/img]

It should show "leaning daniweb.com 2 learn" in the other textbox

Like
[img]http://screensnapr.com/e/3MW0jl.png[/img]

So the line which should contain daniweb.com, it should appear on other textbox.

You could use this to get a specified line from the TextBox.

TextBox2.Text = TextBox1.Lines(2) '// get line 3.

Or you could loop through all the lines.

For Each txtLine As String In TextBox1.Lines '// loop thru all lines in TextBox.
            If txtLine.StartsWith("leaning daniweb.com") Then '// check if line .StartsWith a specified String.
                TextBox2.Text = txtLine '// get line content.
                Exit For '// exit loop since line was located.
            End If
        Next

Hello codeorder

Thanks for this.

But if the line doesn't starts with the word "leaning daniweb.com" then how will i do it.

Like if in textbox1 is written

vb.net
gettext
2 learn leaning daniweb.com
vb2learn

Also, how will i do it if there are multiple lines starting with "leaning daniweb.com"

Eg:

vb.net
gettext
leaning daniweb.com 2 learn
leaning daniweb.com code learn
leaning daniweb.com order learn
vb2learn

And i want to get all the lines starting with leaning daniweb.com

Edited 5 Years Ago by vb2learn: n/a

>>But if the line doesn't starts with the word "leaning daniweb.com" then how will i do it.
Use .Contains("your text") instead of .StartsWith("your text") .

>>Also, how will i do it if there are multiple lines starting with "leaning daniweb.com"
>>And i want to get all the lines starting with leaning daniweb.com
Don't Exit For to exit the loop and add to the .Text in the other TextBox.

TextBox2.Clear() '// clear for new data.
        For Each txtLine As String In TextBox1.Lines '// loop thru all lines in TextBox.
            If txtLine.Contains("leaning daniweb.com") Then '// check if line .Contains a specified String.
                '// If Not empty Then add new line and content, Else just add content.
                If Not TextBox2.Text = "" Then TextBox2.Text &= vbNewLine & txtLine Else TextBox2.Text = txtLine
            End If
        Next

Hello
Thanx codeorder once again for the code mate.

Marked As Resolved

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