VB.NET: If then else statements

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • justbailey
    New Member
    • Aug 2008
    • 1

    VB.NET: If then else statements

    I am very new and bad at programming and taking a vb.net class. I am trying to troubleshoot my code to see why it is not running properly. I found a thread in another forum that said I could not put multiple then statements in, that vb will only execute the first statement. This is the first time I had heard this, is it true. Below is an example of what I mean. Thanks in advance!

    If slot1 = slot2 andalso slot1 = slot3 then
    runningCredits = runningCredits + 50
    me.textbox1.tex t = You hit the jackpot
    end if


    -Justin
  • nikul156
    New Member
    • Mar 2008
    • 13

    #2
    Originally posted by justbailey
    I am very new and bad at programming and taking a vb.net class. I am trying to troubleshoot my code to see why it is not running properly. I found a thread in another forum that said I could not put multiple then statements in, that vb will only execute the first statement. This is the first time I had heard this, is it true. Below is an example of what I mean. Thanks in advance!

    If slot1 = slot2 andalso slot1 = slot3 then
    runningCredits = runningCredits + 50
    me.textbox1.tex t = You hit the jackpot
    end if

    -Justin
    May Be try using two IF's -

    If slot1 = slot2 then
    if slot1=slot3 then
    runningCredits = runningCredits + 50
    me.textbox1.tex t = "You hit the jackpot"

    end if
    end if

    Comment

    • QVeen72
      Recognized Expert Top Contributor
      • Oct 2006
      • 1445

      #3
      Hi,

      Try This:

      [code=vb]
      If slot1 = slot2 And slot1 = slot3 then
      runningCredits = runningCredits + 50
      Me.Textbox1.Tex t = "You hit the jackpot"
      End If
      [/code]

      Regards
      Veena

      Comment

      Working...