Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 132,337 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,103 people online right now. Registration is fast and FREE... Join Now!




Help on this solution

 
Reply to this topicStart new topic

Help on this solution

difficultproblems
post 19 Feb, 2008 - 04:00 PM
Post #1


New D.I.C Head

*
Joined: 19 Feb, 2008
Posts: 4

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! code.gif

This post has been edited by Martyr2: 19 Feb, 2008 - 04:26 PM
User is offlineProfile CardPM

Go to the top of the page

Martyr2
post 19 Feb, 2008 - 04:32 PM
Post #2


Programming Theoretician

Group Icon
Joined: 18 Apr, 2007
Posts: 5,027



Thanked 173 times

Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions


What part is actually giving you the trouble? You seem to have some half way decent psuedocode in there that can guide you through the process. You just have to follow along.
User is offlineProfile CardPM

Go to the top of the page

difficultproblems
post 19 Feb, 2008 - 05:35 PM
Post #3


New D.I.C Head

*
Joined: 19 Feb, 2008
Posts: 4

QUOTE(Martyr2 @ 19 Feb, 2008 - 05:32 PM) *

What part is actually giving you the trouble? You seem to have some half way decent psuedocode in there that can guide you through the process. You just have to follow along.

I don't know why it is still underlining the lastPart and the firstPart and the pigLatin. I have tried different versions but it does not want to work. Can you help, I would appreciate it, thank you
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 03:30AM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month