![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: May 2005
Location: Charleston, SC
Posts: 11
Rep Power: 0
![]() |
pig latin exercise - I'm stuck
half way down i am getting an exception error and can't figure out, mind and eyes are numb....
Public Class MainForm Private Sub xExitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xExitButton.Click Me.Close() End Sub Private Sub xConvertButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xConvertButton.Click ' displays the pig latin form of a word Dim originalWord As String Dim pigLatin As String originalWord = Me.xWordTextBox.Text If originalWord.Substring(0, 1).ToUpper Like "[AEIOU]" Then ' if the word begins with a vowel, add "-way" to the end of the word pigLatin = originalWord & "-way" Else Dim isVowelOrY As Boolean 'Dim indexNum As Integer 'Dim word As String Dim length As Integer Do pigLatin = originalWord.Substring(0, 1) originalWord = originalWord.Remove(0, 1) length = originalWord.Length Loop Until originalWord.Substring(0, 1) Like "[AEIOU]" If originalWord.Substring(0, 1) Like "[AEIOU]" Then originalWord = originalWord & "ay" Me.Label1.Text = "This word in pig latin is " & originalWord.ToLower & "." End If If Not isVowelOrY Then ' if the word does not contain a vowel or the letter y, ' add "-way" to the end of the word pigLatin = originalWord & "-way" Else ' if the word does not begin with a vowel or the letter y, but it contains ' a vowel or the letter y, add a dash to the end of the word, then ' continue moving the first character to the end of the word until ' end of the word End If End If 'display pig Latin form of the word Me.xPigLatinLabel.Text = pigLatin Me.xWordTextBox.Focus() End Sub End Class |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Latin word for english word "and" | bigguy | Coder's Corner Lounge | 14 | May 31st, 2007 10:39 PM |
| Exercise C++ Exercise taken from AP Computer Science 1995 Exam, Free-response in C++. | pr0gm3r | C++ | 4 | Jul 31st, 2005 2:58 PM |
| Having trouble with an exercise in the C book. | linuxpimp20 | C | 6 | Jul 6th, 2005 7:22 AM |
| Multiple http-requests are stuck | MereMortal | C++ | 0 | May 4th, 2005 3:08 AM |