I need help finishing this solution. Can anyone give me some advice. Thank you
CODE
Public Class MainForm
Private Sub xExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xExitButton.Click
Me.Close()
End Sub
Private Sub xWordTextBox_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles xWordTextBox.Enter
Me.xWordTextBox.SelectAll()
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 = "ant" is "ant-way".
Else
' if the word does not begin with a vowel, determine whether
' it contains a vowel or the letter Y
Dim isVowelOrY As Boolean
Dim indexNum As Integer
' search each character in the word for a vowel or the letter y
' stop the search when the entire word has been searched or
' when a vowel or the letter y is found
Do While indexNum < originalWord.Length AndAlso Not isVowelOrY
If originalWord.Substring(indexNum, 1).ToUpper() Like "[AEIOUY]" Then
'add code "ay" to the end of the word
End If
'indexNum = "Chair" is "air-Chay"
Loop
If Not isVowelOrY Then
' if the word does not contain a vowel or the letter y,
' add "-way" to the end of the word
'********add code "56" is "56-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
' the first character is A, E, I, O, U, or Y, then add "ay" to the
' end of the word
Dim firstPart As String
Dim lastPart As String
' indexNum is always 1 greater than where the vowel or letter y was located
'firstPart = "A, E, I, O, U, or Y"
'lastPart = "ay"
pigLatin = lastPart & "-" & firstPart & "ay"
End If
End If
'display pig Latin form of the word
Me.xPigLatinLabel.Text = pigLatin
Me.xWordTextBox.Focus()
End Sub
End Class
*edit: Please use code tags in the future, thanks!
This post has been edited by Martyr2: 19 Feb, 2008 - 04:26 PM