展开全部
Dim Temp As Double
Dim D1, D2 As Integer
Dim T, P As Integer
Private Sub Command1_Click(Index As Integer)
If P = 0 Then
Text1.Text = Text1.Text & Command1(Index).Caption
D1 = Val(Text1.Text)
ElseIf P = 1 Then
Text2.Text = Text2.Text & Command1(Index).Caption
D2 = Val(Text2.Text)
End If
End Sub
Private Sub Command2_Click(Index As Integer)
P = 1
T = Index + 1
Label1.Caption = Command2(Index).Caption
End Sub
Private Sub Command3_Click()
P = 0
Select Case T
Case 1
Temp = D1 + D2
Case 2
Temp = D1 - D2
Case 3
Temp = D1 * D2
Case 4
Temp = D1 / D2
End Select
Text3.Text = Temp
End Sub
Private Sub Command4_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Label1.Caption = ""
Label2.Caption = ""
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Label1.Caption = ""
Label2.Caption = ""
End Sub
Dim D1, D2 As Integer
Dim T, P As Integer
Private Sub Command1_Click(Index As Integer)
If P = 0 Then
Text1.Text = Text1.Text & Command1(Index).Caption
D1 = Val(Text1.Text)
ElseIf P = 1 Then
Text2.Text = Text2.Text & Command1(Index).Caption
D2 = Val(Text2.Text)
End If
End Sub
Private Sub Command2_Click(Index As Integer)
P = 1
T = Index + 1
Label1.Caption = Command2(Index).Caption
End Sub
Private Sub Command3_Click()
P = 0
Select Case T
Case 1
Temp = D1 + D2
Case 2
Temp = D1 - D2
Case 3
Temp = D1 * D2
Case 4
Temp = D1 / D2
End Select
Text3.Text = Temp
End Sub
Private Sub Command4_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Label1.Caption = ""
Label2.Caption = ""
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Label1.Caption = ""
Label2.Caption = ""
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
给个邮箱发给你
追问
178504338@qq.com
追答
已经发给你了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
例如点击加号按钮的事件
private sub sum_click()
dim a as long
a=val(text1.text)+val(text2.text)
label1.caption=format(a,"0.000")
end sub
private sub sum_click()
dim a as long
a=val(text1.text)+val(text2.text)
label1.caption=format(a,"0.000")
end sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询