Results 1 to 2 of 2

Thread: How do I make my program count the amount of words in a text box?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Lindenwold, NJ, USA
    Posts
    67

    Arrow

    How do I make my program count the amount of words in a text box?
    Frankie Weindel
    VB 6 Learning Edtion SP3

  2. #2
    Lively Member mykg4orce's Avatar
    Join Date
    Oct 2000
    Location
    CANADA
    Posts
    92

    Exclamation 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
  •  



Click Here to Expand Forum to Full Width