I have an assignment that asks me to create an application that lets the user enter a word or phrase, then displays the number of vowels found in that word or phrase.
Here's what I have so far:
Dim mystring As String = Me.txtenter.Text Dim chars As Char() = mystring.ToCharArray() Dim newString As System.Text.StringBuilder = New System.Text.StringBuilder() For Each c As Char In chars Dim strpattern As String strpattern = "[U,u,E,e,O,o,A,a,I,i]" Dim strstore As String strstore = c Like strpattern If strstore = True Then Dim intnumber As Integer = 0 intnumber = intnumber + 1 End If Next c newString.Append("There are " & intnumber & " vowels") Me.lblanswer.Text = newString.ToString()
I try to run it, but there happens to be a "blue wavy line" under the word "intnumber" in the line
newString.Append("There are " & [U]intnumber[/U] & " vowels")
It says "name intnumber is not declared".
May you show me a way to fix this? and by the way, is the code above correct, because i'm afraid I might mistake somewhere in the Loop.
Thanks for your time!