帮我解释下下面的VB代码

来源:百度知道 编辑:UC知道 时间:2024/05/04 05:13:54
Dim Num1, Num2 As Single
Dim StrNum1, StrNum2 As String
Dim FirstNum As Boolean
Dim PointFlag As Boolean
Dim Runsign As Integer
Dim SignFlag As Boolean
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0 To 9
If FirstNum Then
StrNum1 = Str(Index)
FirstNum = False
Else
StrNum1 = LTrim(StrNum1) + LTrim(Str(Index))
End If
Text1.Text = Val(StrNum1)
Case 10
If Not PointFlag Then
If FirstNum Then
StrNum1 = "0."
FirstNum = False
Else
StrNum1 = LTrim(StrNum1) + LTrim(".")
End If
Else
Exit Sub
End If
PointFlag = True
Text1.Text = Val(StrNum1)
Case 12 To 15
FirstNum = True
PointFlag = False
If SignFlag Then
Call Run
Else
SignFlag = True
StrNum2 = StrNum1
StrNum1 = ""
End If
Runsign = Index - 11
Case 11
On E

'声明一堆变量
Dim Num1, Num2 As Single
Dim StrNum1, StrNum2 As String
Dim FirstNum As Boolean
Dim PointFlag As Boolean
Dim Runsign As Integer
Dim SignFlag As Boolean
Private Sub Command1_Click(Index As Integer) '按键控件数组单击事件
Select Case Index '根据控件的索引进行 select case 操作
Case 0 To 9 '0-9按钮
If FirstNum Then
StrNum1 = Str(Index)
FirstNum = False
Else
StrNum1 = LTrim(StrNum1) + LTrim(Str(Index))
End If
Text1.Text = Val(StrNum1)
Case 10 '小数点按钮
If Not PointFlag Then
If FirstNum Then
StrNum1 = "0."
FirstNum = False
Else
StrNum1 = LTrim(StrNum1) + LTrim(".")
End If
Else
Exit Sub
End If
PointFlag = True
Text1.Text = Val(StrNum1)
Case 12 To 15 '加减乘除
FirstNum = True
PointFlag = False
If SignFlag Then
Call Run
Else
SignFlag = True
StrNum2 = StrNum1
StrNum1 = ""