: VBA.
VBA .
.
.
. , , . , 10000 ., 5 % . , . 10000 ., , .
. , , . VBA. , . . VBA:
If Then 1 Else 2
: , If. - . , : True () False (). , 1, Then. , 2, Else. VBA.
If... Then... Else , . . - ( ) , , ( ) . , . :
|
|
If Then
1
Else
2
End If
End If, , , . , .
, , ( , ). . ( ) :
If Then
. , If, , , Then ( ). , If, , . :
IfThen
EndIf
. :
If 1 Then
1
ElseIf 2 Then
2
Else
3
EndIf
. 1, If. ( True), 1, Then ElseIf.
1 ( False), . 2. True, 2, Then Else. 2 , 3, Else End If.
.
1. , :
1.1. . Textbox1 . Textbox2 . , Textbox2 . , 10000 .
Textbox2 , Visible False. , , .
Textbox3 , . , , Textbox3, , Textbox1.
|
|
1.2. Label1, Label2 Label3, . Label1 ( ) , ( ) . Label2 ( ) Textbox2, , , 10000 . Label3 .
1.3. CommandButton1, CommandButton2, CommandButton3 CommandButton4. CommandButton1 () . CommandButton2 () , . CommandButton3 ( ) . CommandButton4 () .
.1.
. 1.
2. CommandButton1. CommandButton1_Click, : Sum ; Skidka , ; Itog , . Sum , Skidka Itog .
3. Val , Textbox1, Sum.
4. If : Sum>10000.
5. Sum. 10000, :
1. , 5 % ,
Skidka.
2. ,
.
Itog.
3. Textbox2
Label2.
4. Label2 : .
5.
Str
Textbox2 Texbox3.
Then.
6. 10000, :
1. Itog , Summa,
, Itog Textbox3.
2. Label2 : , .
Else.
, , :
If Sum > 10000 Then
Skidka = Sum * 0.05
TextBox2.Text = Str(Skidka)
TextBox2.Visible = True
Itog = Sum - Skidka
TextBox3.Text = Str(Itog)
|
|
Label2.Caption = " "
Label2.Visible = True
Else
Itog = Sum
TextBox3.Text = Str(Itog)
Label2.Visible = True
Label2.Caption = ",
"
End If
7. , CommandButton2. :
1. TextBox1,TextBox2 Textbox3.
2. Label2 Textbox2 .
Text . Visible False. CommandButton3 ( ) CommandButton4 ().
, .
8. :
Private Sub CommandButton1_Click()
Dim Sum As Integer