Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic (http://www.programmingforums.org/forum18.html)
-   -   pig latin exercise - I'm stuck (http://www.programmingforums.org/showthread.php?t=13363)

boatn19 Jun 17th, 2007 2:48 PM

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

DaWei Jun 17th, 2007 3:47 PM

I'll be a monkey's oinkle. You didn't read the "How to Post a Question" thread, did you? Shamey, shamey, shamey.

boatn19 Jun 17th, 2007 4:35 PM

thanks for your assistance

DaWei Jun 17th, 2007 5:59 PM

Thank you for acting like an entitled brat. It made my day.

Infinite Recursion Jun 17th, 2007 11:34 PM

Your code is already hard to read as it is... maybe because its in VB, or maybe because you forgot to use code tags. :/. Repost with code tags and post the exact error. My eyes go numb looking at what you sent so far.

Also, for a bit more of an insight on this, look at the other thread you made.


All times are GMT -5. The time now is 2:30 AM.

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