IF statement never works

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • radom
    New Member
    • Feb 2008
    • 37

    IF statement never works

    what I need is if the text box = the second text then change but it always say it dosent i am useing vb2008 this is for a school spelling program it flash the spelling word then they type it. if they get it wrong then the same word should apper. the problem is that if they get the word right it dosent get a new word


    [CODE=vbnet]If TextBox1.Text = TextBox2.Text Then
    TextBox1.Text = ""
    Number = Int((20 - 1 + 1) * Rnd()) + 1
    'TextBox2.Text = number

    Select Case Number
    Case 1
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\1.txt")
    Case 2
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\2.txt")
    Case 3
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\3.txt")
    Case 4
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\4.txt")
    Case 5
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\5.txt")
    Case 6
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\6.txt")
    Case 7
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\7.txt")
    Case 8
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\8.txt")
    Case 9
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\9.txt")
    Case 10
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\10.txt")
    Case 11
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\11.txt")
    Case 12
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\12.txt")
    Case 13
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\13.txt")
    Case 14
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\14.txt")
    Case 15
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\15.txt")
    Case 16
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\16.txt")
    Case 17
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\17.txt")
    Case 18
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\18.txt")
    Case 19
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\19.txt")
    Case 20
    CHOSENWORD = My.Computer.Fil eSystem.ReadAll Text("C:\the game attic inv\20.txt")
    End Select
    End If

    TextBox2.Text = CHOSENWORD
    TextBox2.Visibl e = True
    Timer1.Enabled = True
    [/CODE]
    Last edited by Killer42; Mar 19 '08, 02:55 AM. Reason: Added CODE=vbnet tag
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Better trim and convert the text to uppercase before comparing.

    In which event you are comparing the text ?

    Comment

    • radom
      New Member
      • Feb 2008
      • 37

      #3
      The first if statement

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Please let us know whether trimming and standardising the case help. If not, it'd help if you can show us a sample of the values that should match, but don't.

        Comment

        Working...