|
-
Nov 8th, 2000, 09:55 PM
#1
Thread Starter
Lively Member
How do I make my program count the amount of words in a text box?
Frankie Weindel
VB 6 Learning Edtion SP3
-
Nov 8th, 2000, 10:07 PM
#2
Lively Member
here it is
Option Explicit ' make vars available to all routines.
Dim SingleCharacter As String
Dim i, j, k, CountWords, Count8 As Integer
Dim MyString() As String
Private Sub cmdGatherInfo_Click()
LineOfText = txtMain.Text 'initialize the variable.
For i = 1 To Len(LineOfText)
If Mid$(LineOfText, i, 1) <> " " Then
ReDim Preserve MyString(CountWords)
Do Until Mid$(LineOfText, i, 1) = " " Or i > Len(LineOfText)
MyString(CountWords) = MyString(CountWords) & Mid$(LineOfText, i, 1)
i = i + 1
Loop
CountWords = CountWords + 1
End If
Next
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|