RichTextbox word count????

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.
5 posts Page 1 of 1
Contributors
User avatar
lesan101
Top Poster
Top Poster
Posts: 193
Joined: Tue Jun 29, 2010 8:10 am

RichTextbox word count????
lesan101
i have a richtextbox1 and a textbox1

i want the textbox1 to display how many words are inside the richtextbox.

but idk the code : ((
Image
User avatar
Smiley
VIP - Donator
VIP - Donator
Posts: 269
Joined: Sat Dec 19, 2009 3:39 pm

Re: RichTextbox word count????
Smiley
Here you go hope it works. cooll;

Download:
WindowsApplication1.zip
You do not have the required permissions to view the files attached to this post.
User avatar
lesan101
Top Poster
Top Poster
Posts: 193
Joined: Tue Jun 29, 2010 8:10 am

Re: RichTextbox word count????
lesan101
Smiley wrote:
Here you go hope it works. cooll;

Download:
WindowsApplication1.zip
thanks for the try man.. but thats letter counting.. im looking for word counting. -__-
Image
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: RichTextbox word count????
mandai
Try:
Code: Select all
        Dim spaceArray As String() = RichTextBox1.Text.Replace(vbLf, " ").Split(" "c)
        Dim wordcount As Integer = 0
        For i As Integer = 0 To spaceArray.Length - 1
            If spaceArray(i).Length > 0 Then wordcount += 1
        Next
        MsgBox(wordcount & " words found")
User avatar
lesan101
Top Poster
Top Poster
Posts: 193
Joined: Tue Jun 29, 2010 8:10 am

Re: RichTextbox word count????
lesan101
mandai wrote:
Try:
Code: Select all
        Dim spaceArray As String() = RichTextBox1.Text.Replace(vbLf, " ").Split(" "c)
        Dim wordcount As Integer = 0
        For i As Integer = 0 To spaceArray.Length - 1
            If spaceArray(i).Length > 0 Then wordcount += 1
        Next
        MsgBox(wordcount & " words found")

AWESOME IT WORKED. THANKS MANDAI : )
Image
5 posts Page 1 of 1
Return to “Tutorial Requests”