返回列表 发帖

简单VB问题!

想用VB编一个简单的计算器,现需要最关键的那部分原代码,能否帮助提供一下!或说一下自己的思路~      谢谢各位兄台!

简单VB问题!


Dim x, y As Integer
Private Sub exit_Click()
End
End Sub
Private Sub Command1_Click()
If password.Text = "1234" Then
'产生两个加数
Randomize Timer
x = CInt(Rnd * 100)
y = CInt(Rnd * 100)
add1.Caption = x
add2.Caption = y
Else
MsgBox "对不起,密码有误!", 1, "提醒"
End If
End Sub
Private Sub Command2_Click()
If char.Caption = "+" Then
result.Text = Val(add1.Caption) + Val(add2.Caption)
End If
If char.Caption = "-" Then
result.Text = Val(add1.Caption) - Val(add2.Caption)
End If
If char.Caption = "*" Then
result.Text = Val(add1.Caption) * Val(add2.Caption)
End If
If char.Caption = "/" Then
result.Text = Val(add1.Caption) / Val(add2.Caption)
End If
End Sub


Private Sub Option1_Click()
char.Caption = Option1.Caption
End Sub
Private Sub Option2_Click()
char.Caption = Option2.Caption
End Sub
Private Sub Option3_Click()
char.Caption = Option3.Caption
End Sub
Private Sub Option4_Click()
char.Caption = Option4.Caption
End Sub

TOP

简单VB问题!

不错。。

TOP

简单VB问题!

他只不过是想有一个计时器吗?!!
代码有这么多吗?!~~~~~~~~~

TOP

返回列表 回复 发帖