webnik
Jan 14th, 2000, 09:22 AM
What is the code to count the total words and total letters from textbox1 then listing the number of times a particular word is displayed in listbox1? Now the totals must be displayed in some other box separate from the listbox. A command button (we'll call it "parse")will execute the whole action when clicked on.
thanks
DiGiTaIErRoR
Jan 14th, 2000, 05:01 PM
get the total number of characters use
Len{string as string)
to get number of words do this:
[code]
Dim CountWords As Integer
Dim NumOfWordsStr As String
NumOfWordsStr = Text1.Text
Do
CountWords = CountWords + 1
NumOfWordsStr = Mid$(NumOfWordsStr, InStr(NumOfWordsStr, " ") + 1, Len(Text1.Text))
Loop Until InStr(NumOfWordsStr, " ") = 0
Text2.Text = CountWords + 1
[code]
You may need a little editing if you want to include enters and other stuff but this is the basics about the parse you could find an enter or space and find each word and see if it's in there again like the space check above. Hope this helps!
------------------
DiGiTaIErRoR