Pig latin program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • johnmac
    New Member
    • Nov 2007
    • 6

    Pig latin program

    I'm trying to make an english to pig latin program
    and it doesn't seem to show my output in my answer.text box

    [CODE=vbnet]Dim strInput, str1stCharacter , strOutput, stranswer As String, intStringLength As Integer
    strInput = txtinput.Text
    str1stCharacter = Microsoft.Visua lBasic.Left(str Input, 1)
    If str1stCharacter = "A" Or str1stCharacter = "E" Or str1stCharacter = "I" Or str1stCharacter = "O" Or str1stCharacter = "U" Then
    strOutput = strInput & "WAY"
    Else
    intStringLength = Len(strInput) - 1
    strOutput = Microsoft.Visua lBasic.Right(st rInput, intStringLength ) & str1stCharacter & "WAY"
    strOutput = stranswer
    txtoutput.Text = stranswer[/CODE]
    anyone clue why?
    Last edited by Killer42; Nov 7 '07, 01:11 AM. Reason: Added CODE=vbnet tag
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Sure, that's easy. You're overwriting everything with the empty value from strAnswer.

    By the way, is there supposed to be an End If in there somewhere?
    Last edited by Killer42; Nov 7 '07, 01:11 AM.

    Comment

    • johnmac
      New Member
      • Nov 2007
      • 6

      #3
      what do you mean empty value in stranswer (confused)
      yup end if at the end i just forgot to put that in my post.

      thanks

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by johnmac
        what do you mean empty value in stranswer (confused)
        yup end if at the end i just forgot to put that in my post.
        Well, let me put it like this. If you follow the code through, step by step, what is stranswer used for?

        The only real secret to effectively debugging code is to read it and follow it the way the computer does - that is, one step at a time. You have to forget about what you think should be happening, and see what the code actually says.

        Comment

        • johnmac
          New Member
          • Nov 2007
          • 6

          #5
          thanks a lot for the help ;)
          it works great now.
          i knew what i did wrong , which was pretty dumb -_-'.

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Originally posted by johnmac
            thanks a lot for the help ;)
            it works great now.
            i knew what i did wrong , which was pretty dumb -_-'.
            No worries. We've all "been there, done that". :)

            Comment

            Working...