新手学vb的问题!!!
有以下的代码但我不明白Form1.Tag = "T"有什么做用,请各位大虾指导一下!!
Dim v As Boolean '是否按了操作符
Dim s As Integer '运算符
Dim x As Double, y As Double '操作数
Private Sub Command1_Click(Index As Integer)
If Form1.Tag = "T" Then
If Index = 10 Then
Text1.Text = "0."
Else
Text1.Text = Command1(Index).Caption
End If
Form1.Tag = ""
Else
Text1.Text = Text1.Text & Command1(Index).Caption
End If
End Sub
Private Sub Command2_Click(Index As Integer)
Form1.Tag = "T"
If v Then
x = Val(Text1.Text)
v = Not v
Else
y = Val(Text1.Text)
Select Case s
Case 0
Text1.Text = x + y
Case 1
Text1.Text = x - y
Case 2
Text1.Text = x * y
Case 3
If y <> 0 Then
Text1.Text = x / y
Else
MsgBox ("y can no 0")
Text1.Text = x
v = False
End If
Case 4
y = 0
v = False
End Select
x = Val(Text1.Text)
End If
s = Index
End Sub