Visual Basic Pig Latin

I am having trouble with a program that allows the user to input a word that is then converted to pig latin form. Cases that begin with vowels or numbers are working fine as well as cases where there is only one consonant before the first vowel. However, anytime there is more that one consonant in a row at the beginning of a word, the program does not work correctly (ex. chair is converted to haircay. It should be airchay). A loop is needed I assume, but I'm not quite sure how to do so. Any help would be greatly appreciated.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

Public Class frmMain
    Private Sub btnConvert_Click(sender As Object, e As EventArgs) Handles btnConvert.Click
        Dim strInput As String
        Dim strFirstCharacter As String
        Dim strOutput As String
        Dim intLength As Integer = 0

        strInput = txtWord.Text

        strFirstCharacter = strInput.Substring(0, 1)

        Select Case strFirstCharacter.ToUpper()
            Case "A", "E", "I", "O", "U", "Y", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
                strOutput = strInput & "-way"
            Case Else
                strOutput = strInput.Substring(1) & strInput.Substring(0, 1) & "ay"
        End Select

        strOutput.ToLower()
        lblPigLatin.Text = strOutput

    End Sub

    Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub
End Class
Last edited on
You may want to try the "Window's Programming" or "Lounge" forums (edit post and move there) to get the most help considering you are not using c++ but instead visual basic.
Ok thanks. I believe I have done so.
can i suggest daniweb.com? they actually have a visual basic forum
Topic archived. No new replies allowed.