473,320 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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


-Justin
Aug 4 '08 #1
2 1781
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
1,445 Expert 1GB
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

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

Similar topics

6
by: Bart Nessux | last post by:
Should an if statement have a corresponding else statement? Or, is it OK to have an if statement by itself. For completeness, it seems the two should be together, but from experience I know that a...
77
by: Tim Anderson | last post by:
I've begun to set down some pros and cons here: http://www.itwriting.com/phorum/list.php?f=6 Thought I'd mention it as it's a topic of such enduring interest :-) Tim
5
by: InstallAware | last post by:
For Press Inquiries: Sinan Karaca InstallAware Software Corporation 336 Guerrero Street, San Francisco CA 94103 415 358 4094 (voice/fax) sinank@installaware.com http://www.installaware.com/ ...
19
by: GMKS | last post by:
Hello all, I have 13 check boxes on a form. I am trying to check all the check boxes to determine if they are true or false when I close the form. At present only the first IF...Then...Else...
192
by: Vortex Soft | last post by:
http://www.junglecreatures.com/ Try it and tell me what's happenning in the Microsoft Corporation. Notes: VB, C# are CLS compliant
3
by: Amy | last post by:
Hi, I have 6 If Then Else statements I was supposed to write. I did so but I know that they have to be wrong because they all look the same. Could someone take a look at them and point me in the...
22
by: MLH | last post by:
I would like to test some of this code in the debug window... Option Compare Database Option Explicit Private Sub Command0_Click() #If Win32 Then MsgBox "Hey! It's WIN32." #End If End Sub
14
by: lawjake | last post by:
I am having a dispute at work over endifs, and cannot find any treatise on this. So I am hoping that I can get a lot of correspondece confirming my belief. Here it is: I believe the following:...
5
by: =?Utf-8?B?Y2FyYm8=?= | last post by:
I am getting odd behavior in my code, first I thought it was caused by SP1 but now I have the same issue with a vanilla version of VS 2005. When I execute a function that contains an if statement....
3
by: Simone | last post by:
Hello I am pretty new to asp.net :) I have a program that loops through a few sql statements and performs inserts. The problem is the sql statements are different for every upcoming new...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.