[HELP] RichTextBox.Append()

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions 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.
4 posts Page 1 of 1
Contributors
User avatar
Scottie1972
Codenstuff Elite
Codenstuff Elite
Posts: 953
Joined: Thu Jan 14, 2010 5:48 am

[HELP] RichTextBox.Append()
Scottie1972
ok here is my problem.

i have a IRC Client that i am working on. Everything works great cept one thing.
Im having trouble when a line is append("")ed to the richtextbox control.

here is the idea.

say, the Appended line contains ("Hey you guys, where did Bob go?")

now let say i wanted to just Find() words in that last line.
(Not the whole richtextbox) - this lags after about 75 lines.

lets say the words i want to Find() are: guys, where, & Bob.

any ideas?
Image
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Re: [HELP] RichTextBox.Append()
comathi
You could try by isolating the last line of the RichTextBox, like so:
Code: Select all
Dim lastLine As String
Dim rtbLines As Integer = RichTextBox1.Lines.Length

lastLine = RichTextBox1.Lines(rtbLines - 1)
Then you could use the Find() function on lastLine cooll;
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Re: [HELP] RichTextBox.Append()
XTechVB
Try this
Code: Select all
For Each fMatch As Match In Regex.Matches(RichTextBox1.Lines(RichTextBox1.Lines.Length - 1), "\b(guys|where|Bob)\b")
            MessageBox.Show(fMatch.Value)
        Next
You can add as many words as you want.
You can find me on Facebook or on Skype mihai_92b
User avatar
Scottie1972
Codenstuff Elite
Codenstuff Elite
Posts: 953
Joined: Thu Jan 14, 2010 5:48 am

Re: [HELP] RichTextBox.Append()
Scottie1972
XTechVB wrote:
Try this
Code: Select all
For Each fMatch As Match In Regex.Matches(RichTextBox1.Lines(RichTextBox1.Lines.Length - 1), "\b(guys|where|Bob)\b")
            MessageBox.Show(fMatch.Value)
        Next
You can add as many words as you want.
this worked get.
ill need to check it with 500 lines or more to see if it still is laggy but seems to work like i need it to.
+rep ya!

scottie
Image
4 posts Page 1 of 1
Return to “Coding Help & Support”