CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2001
    Location
    Lincs, UK
    Posts
    16

    Counting vowels in text box

    Can I count the vowels in a text box or in a file.


  2. #2
    Join Date
    Sep 2001
    Location
    Québec, Canada
    Posts
    1,923

    Re: Counting vowels in text box

    You must create your own functions that will receive as parameters a String and return a integer


    private function VowelCount(Word as string) as Integer
    'some code
    ...
    end function

    'into another function
    Dim NumberOfVowel as integer
    Dim WordToCheck as string

    WordToCheck = "word to check"
    NumberOfVowel = VowelCount(WordToCheck)




    There is no functions that make that in VB6

    CodeGuru VB FAQ Visual Basic Frequently Asked Questions
    VB Code color Tool to color your VB code on CodeGuru
    Before you post Importants informations to know before posting

  3. #3
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Counting vowels in text box


    private Function VowelCount(strText as string) as long
    dim T as Long
    dim VC as long
    for T = 1 to len(strText)
    Select Case UCase(mid(strText,T,1))
    Case "A","E","U","I","O"
    VC = VC + 1
    End Select
    next T
    VowelCount = VC
    End Function




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  4. #4
    Join Date
    Apr 2001
    Location
    Lincs, UK
    Posts
    16

    Re: Counting vowels in text box

    How do I create my own Functions Please note I am a biginer
    dar1


  5. #5
    Join Date
    Apr 2001
    Location
    Lincs, UK
    Posts
    16

    Re: Counting vowels in text box

    How do I create my own Functions Please note I am a biginner
    dar1


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

Featured