Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Jun 17th, 2007, 1:48 PM   #1
boatn19
Newbie
 
Join Date: May 2005
Location: Charleston, SC
Posts: 11
Rep Power: 0 boatn19 is on a distinguished road
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
boatn19 is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:14 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC