

|
If Condition =
Value then |
Break
down
(all break downs are numbered by lines of
code!)
| 1. We
add the if statement, If our condition is met then... 2. We tell VB what to do if your condition is met. 3. Now we close up the if statement with the End If command. This tells VB that were done telling it what to do and to end the IF statement. |
Multiple Conditions
|
If Label1.Caption < 10 Then |
You can have as many if
statements that you want, just remember to keep them indented for
debugging.
| 1.
We ask vb if the caption of label1 is less then
10. 2. If the caption is less then 10, then a msgbox pops up. 3. We End the statement. |
| 4.
If the caption wasn't less then 10, then
VB reads this statement, now we ask VB if the caption is greater then
10. 5. If the caption is greater then 10, we send a MSG box up. 6. We End the statement. |
| 7. Now, if the caption wasn't less then 10,
and wasn't greater then 10, VB reads this statement. 8. If the caption is 10 then we send a MSG box up. 9. We End the statement. |

Else - as in if the if
condition isn't met then.. well, do something ELSE.
|
If
Label1.Caption = 10 Then |
| 1.
See if Label1.caption equals
10 2. If the first condition is met (if label1.caption = 10) we send a message box up. 3. If the condition was not met, we go to the else statement. 4. Now if the first condition wasn't met, it went to the else, and our statement is to send a msgbox saying it might be less, or it might be greater. |
- Else is
good, but.. I want
more conditionals -
sometimes we call for the
else statements, as in if the if condition isn't met then.. well,
do
something ELSE, but sometimes we want to break down what happens in the else
statement,
as in if its not 10, then. well is it less or greater?
|
If
label1.Caption = 10 Then |
| 1. we
see if the caption is 10 2. If it is 10, then we call a msgbox saying it is. 3. If its not 10, then do whatever is in Else 4. now lets say the label wasn't 10, the else is called, and now we say, well if its not 10, then is it less then 10? if it is then call a MSG telling us its less then 10. 5. well if it wasn't 10, and it wasn't less then 10... is it greater then 10? if it is then call a MSG telling us it is. |
1999-2000 © Erik Helgesen
All Rights Reserved.
Only permitted Images and
Material may be downloaded from this web site.
PhotoShop, Flash, and
Microsoft Visual Basic are registered
trademarks!