求VB简易计算器的代码?
代码是:码
跪求高人给代码!!!
我有更好回答

匿名用户
推荐于 2016-11-11
Private Sub Command1_Click()
Select Case Text2.Text
Case "+"
Text4.Text = Str(Val(Text1.Text) + Val(Text3.Text))
Case "-"
Text4.Text = Str(Val(Text1.Text) - Val(Text3.Text))
Case "*"
Text4.Text = Str(Val(Text1.Text) * Val(Text3.Text))
Visual Basic(简称VB)是Microsoft公司开发的一种通用的基于对象的程序设计语言,为结构化的、模块化的、面向对象的、包含协助开发环境的事件驱动为机制的可视化程序设计语言。是一种可用于微软自家产品开发的语言。
“Visual” 指的是开发图形用户界面 (GUI) 的方法——不需编写大量代码去描述界面元素的外观和位置,而只要把预先建立的对象add到屏幕上的一点即可。
“Basic”指的是 BASIC (Beginners All-Purpose Symbolic Instruction Code) 语言,是一种在计算技术发展历史上应用得最为广泛的语言。
Visual Basic源自于BASIC编程语言。VB拥有图形用户界面(GUI)和快速应用程序开发(RAD)系统,可以轻易的使用DAO、RDO、ADO连接数据库,或者轻松的创建Active X控件,用于高效生成类型安全和面向对象的应用程序。
程序员可以轻松的使用VB提供的组件快速建立一个应用程序。
2024-10-13 广告
Dim data1 As Integer
Dim data2 As Integer
Dim data3 As Integer
Dim result As Integer
Private Sub Command1_Click()
Text1.Text = "7"
End Sub
Private Sub Command10_Click()
Text1.Text = "6"
End Sub
Private Sub Command11_Click()
Text1.Text = "3"
End Sub
Private Sub Command12_Click()
Text1.Text = ""
End Sub
Private Sub Command13_Click()
data1 = Val(Text1.Text)
OperatorState = 1
Text1.Text = ""
End Sub
Private Sub Command14_Click()
data1 = Val(Text1.Text)
OperatorState = 2
Text1.Text = Text1.Text + ""
End Sub
Private Sub Command15_Click()
data1 = Val(Text1.Text)
OperatorState = 3
Text1.Text = Text1.Text + ""
End Sub
Private Sub Command16_Click()
data1 = Val(Text1.Text)
OperatorState = 4
Text1.Text = Text1.Text + ""
End Sub
Private Sub Command2_Click()
Text1.Text = "4"
End Sub
Private Sub Command3_Click()
Text1.Text = "1"
End Sub
Private Sub Command4_Click()
Text1.Text = "0"
End Sub
Private Sub Command5_Click()
Text1.Text = "8"
End Sub
Private Sub Command9_Click()
Text1.Text = "9"
End Sub
Private Sub Command6_Click()
Text1.Text = "5"
End Sub
Private Sub Command7_Click()
Text1.Text = "2"
End Sub
Private Sub Command8_Click()
data2 = Val(Text1.Text)
If (OperatorState = 1) Then
result = data1 + data2
labvarious = labvarious & Text1.Text
End If
If (OperatorState = 2) Then
result = data1 - data2
End If
If (OperatorState = 3) Then
result = data1 * data2
End If
If (OperatorState = 4) Then
result = data1 / data2
End If
Text1.Text = Str(result)
End Sub