Programming Forums
User Name Password Register
 

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

Reply
 
Thread Tools Display Modes
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
Old Jun 17th, 2007, 2:47 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
I'll be a monkey's oinkle. You didn't read the "How to Post a Question" thread, did you? Shamey, shamey, shamey.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jun 17th, 2007, 3:35 PM   #3
boatn19
Newbie
 
Join Date: May 2005
Location: Charleston, SC
Posts: 11
Rep Power: 0 boatn19 is on a distinguished road
thanks for your assistance
boatn19 is offline   Reply With Quote
Old Jun 17th, 2007, 4:59 PM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Thank you for acting like an entitled brat. It made my day.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jun 17th, 2007, 10:34 PM   #5
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,466
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
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.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Reply

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 1:42 AM.

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