VB编写的电脑附件中计算器的代码

来源:百度知道 编辑:UC知道 时间:2024/05/26 18:32:20
我已经画好了那些按扭,用VB编写计算机程序中附件的代码
是科学计算器VB代码。而且给些那文字说明,好吗?谢谢!

Option Explicit

Private Sub Command1_Click()
Text1 = ""
Text2 = ""
Label5.Caption = ""
Text1.SetFocus
Option1.Value = True
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Command3_Click()
If Option1.Value = True Then
Label5.Caption = Val(Text1) + Val(Text2)
End If
If Option2.Value = True Then
Label5.Caption = Val(Text1) - Val(Text2)
End If
If Option3.Value = True Then
Label5.Caption = Val(Text1) * Val(Text2)
End If
If Option4.Value = True Then
Label5.Caption = Val(Text1) / Val(Text2)
End If
Command1.SetFocus
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
Option1.SetFocus
End If
If IsNumeric(Text1.Text) Then

If (KeyAscii = 45) Then
Option2.Value = True
Text2.SetFocus
ElseIf (