4. If condition Then
Logic…
End if
If condition Then
Logic…
Else
Logic….
End if
If condition Then
Logic…
ElseIf condition-n Then
Logic..
Else
Logic…
End If
4
Shyam N. Chawda 9374928879
5. If TotalMarks>150 then
Logic..
End if
If a=b then
Logic..
Else
Logic..
End if
If Marks>0 and Marks<50 then
Logic..
Else if Marks>=50 and Marks<100
then
Logic..
Else if Marks>=100 and Marks<150
then
Logic..
End if
5
Shyam N. Chawda 9374928879
6. When it finds a True condition
Else statement block, which Visual
Basic.net executes if none of the conditions
are True.
You can have any number of ElseIf
6
Shyam N. Chawda 9374928879
7. You can use And / Or condition with it.
Example:
If marks>50 and marks<100 then
statements
Else if marks>=100 and marks<150 then
statements
End if
7
Shyam N. Chawda 9374928879
9. Whereas the If and ElseIf statements
can evaluate a different expression in
each statement,
The Select statement evaluates a
single expression only once and uses
it for every comparison.
9
Shyam N. Chawda 9374928879
10. Select Case testexpression
[Case expressionlist-n
[statements-n]] ...
[Case Else
[elsestatements]]
End Select
10
Shyam N. Chawda 9374928879
11. Select Performance
Case 1 ' Performance is 1.
Return Salary * 0.1
Case 2, 3 ' Performance is 2 or 3.
Return Salary * 0.09
Case 5 To 7 ' Performance is 5, 6, or 7.
Return Salary * 0.07
11
Shyam N. Chawda 9374928879
12. Case 4, 8 To 10 ‘Performance is 4, 8, 9, or 10.
Return Salary * 0.05
Case Is < 14 'Performance is 11, 12, 13.
Return 100
Case Else ' Performance is < 1 or > 14.
Return 0
End select
12
Shyam N. Chawda 9374928879
13. Select Case JobPlace
Case “Ahmedabad”
logic…
Case “Mumbai”,”Delhi”,”Chennai”
logic..
Case Else
logic..
End select 13
Shyam N. Chawda 9374928879
14. If multiple Case statements are True,
only the statements belonging to the
first true Case statement are
executed.
Case Else clause must be the last
Case clause.
14
Shyam N. Chawda 9374928879
15. Use the To keyword to specify a
range of values.
The Is keyword is used to precede
any comparison operators.
15
Shyam N. Chawda 9374928879
16. Enter Color name and according
to it textbox color will change
Enter student no according to no
display message “Good”,”Try best
in next exam”,”Need to improve”
16
Shyam N. Chawda 9374928879