level 1
马王爷12
楼主
Dim v As Boolean
Dim s As Integer
Dim X As Double
Dim Y As Double
Private Sub Command1_Click(Index As Integer)
If Form1.Tag = "s" ThenIf 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 IfEnd SubPrivate Sub Command2_Click(Index As Integer)
Form1.Tag = "s"
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 ("不能以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 SubPrivate Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)End Sub
2013年05月23日 12点05分
1
Dim s As Integer
Dim X As Double
Dim Y As Double
Private Sub Command1_Click(Index As Integer)
If Form1.Tag = "s" ThenIf 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 IfEnd SubPrivate Sub Command2_Click(Index As Integer)
Form1.Tag = "s"
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 ("不能以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 SubPrivate Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)End Sub


