Dim Number, Digits As Integer
Dim MyString As String
Number = 53 ' .
If Number < 10 Then
Digits = 1
ElseIf Number < 100 Then
' - True .
Digits = 2
Else
Digits = 3
End If
' - (single-line).
If Digits = 1 Then MyString = "One" Else MyString = "More than one"
TypeOf Control .
Sub ControlProcessor(ByVal MyControl As Control)
If TypeOf MyControl Is ComboBox Then
Debug.WriteLine ("You passed in a " & TypeName(MyControl))
ElseIf TypeOf MyControl Is CheckBox Then
Debug.WriteLine ("You passed in a " & TypeName(MyControl))
ElseIf TypeOf MyControl Is TextBox Then
Debug.WriteLine ("You passed in a " & TypeName(MyControl))
End If
End Sub
,
If...Then...Else .
(expression)
If...Then...Else
. ,
True False If...Then...Else.
If...Then...Else. ,
:
IntA = 1
IntB = 2
IntC = 3
IntD = 1
If intA=intD And intA=intB Then '
False
'
ElseIf intA=intD And intA<intB Then '
True
'
ElseIf intA=intD Or intA=intB Then '
True
'
ElseIf (intA=intD And intA=intB) Or
intA=intC Then ' False
'
ElseIf intA=intD And Not intA=intB Then '
True
'
ElseIf intA=intD Xor intA<intB Then '
False
'
Else
'
End If
Select Case. Case
testexpression.
expressionlist
.
Case testexpression .
Case , .
Case ,
Case
Else.
If...Then...Else Select Case:
Select Case
sngTAX
Case Is
<= MIN_TAX
sngPREVOZCost = MIN_PREVOZ_COST
Case Is
<= SECOND_TAX
sngPREVOZCost = SECOND_PREVOZ_COST
Case Is
<= THIRD_TAX
sngPREVOZCost = THIRD_PREVOZ_COST
Case Else
sngPREVOZCost = MAX_PREVOZ_COST
End Select