设计一个vb程序,能进行四则运算。。。。。最简单的,截图就行。。。。
Public myflag As Integer
Private Sub add_Click()
Me.subtrack.Enabled = False
Me.ride.Enabled = False
Me.remove.Enabled = False
myflag = 1
Me.Text2.SetFocus
End Sub
Private Sub Command1_Click()
Select Case myflag
Case 1
Me.Text3.Text = Val(Me.Text1) + Val(Me.Text2)
Case 2
Me.Text3.Text = Val(Me.Text1) - Val(Me.Text2)
Case 3
Me.Text3.Text = Val(Me.Text1) * Val(Me.Text2)
Case 4
Me.Text3.Text = Val(Me.Text1) / Val(Me.Text2)
End Select
End Sub
Private Sub Command2_Click()
Me.Text1 = ""
Me.Text2 = ""
Me.Text3 = ""
myflag = 0
Me.subtrack.Enabled = True
Me.ride.Enabled = True
Me.add.Enabled = True
Me.remove.Enabled = True
Me.Text1.SetFocus
End Sub
Private Sub Form_Load()
Me.Text1 = ""
Me.Text2 = ""
Me.Text3 = ""
End Sub
Private Sub remove_Click()
Me.subtrack.Enabled = False
Me.ride.Enabled = False
Me.add.Enabled = False
myflag = 4
Me.Text2.SetFocus
End Sub
Private Sub ride_Click()
Me.subtrack.Enabled = False
Me.add.Enabled = False
Me.remove.Enabled = False
myflag = 3
Me.Text2.SetFocus
End Sub
Private Sub subtrack_Click()
Me.add.Enabled = False
Me.ride.Enabled = False
Me.remove.Enabled = False
myflag = 2
Me.Text2.SetFocus
End Sub