Search and delete

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
3 posts Page 1 of 1
Contributors
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Search and delete
Dummy1912
hello,

can anyone help me with a richtextbox

i want only the lines that contains a string word

for example:

hello how are you today bruno
o hej we doing fine
who's bruno?
we have no idea

so then i only want the lines that contains bruno
to show in a string.

so that i only have those 2 lines left
hello how are you today bruno
who's bruno?


anyone?

thanks
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Re: Search and delete
comathi
This worked for me, I hope it's what you're looking for :)
Code: Select all
 Dim lines() As String
        Dim count As Integer

        For i = 0 To RichTextBox1.Lines.Count - 1
            If RichTextBox1.Lines(i).Contains("bruno") Then
                ReDim Preserve lines(count)

                lines(count) = RichTextBox1.Lines(i)

                count += 1
            End If
        Next

        RichTextBox1.Clear()

        If lines.Count > 0 Then
            For i = 0 To lines.Count - 1
                RichTextBox1.AppendText(lines(i))

                If i < lines.Count Then RichTextBox1.AppendText(vbNewLine)
            Next
        End If
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Search and delete
Dummy1912
clapper; nice job
yes this is the part we looking for

thank you so much #comathi loove;

+rep
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
3 posts Page 1 of 1
Return to “Tutorial Requests”