423,850 Members | 1,661 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,850 IT Pros & Developers. It's quick & easy.

VB.NET: If then else statements

P: 1
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.text = You hit the jackpot
end if


-Justin
Aug 4 '08 #1
Share this Question
Share on Google+
2 Replies


P: 13
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.text = 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.text = "You hit the jackpot"

end if
end if
Aug 4 '08 #2

QVeen72
Expert 100+
P: 1,445
Hi,

Try This:

Expand|Select|Wrap|Line Numbers
  1. If slot1 = slot2 And slot1 = slot3 then
  2. runningCredits = runningCredits + 50
  3. Me.Textbox1.Text = "You hit the jackpot"
  4. End If
  5.  
Regards
Veena
Aug 5 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.