怎样用VB编写一个可以算整数加减的小程序啊 我才接触电脑 不太会 老师布置的作业
2个回答
展开全部
Dim a, b As Integer
Private Sub Command1_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
s = a + b
Text3.Text = Str(s)
End Sub
Private Sub Command2_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
s = a - b
Text3.Text = Str(s)
End Sub
Private Sub Form_Load()
Command1.Caption = "相加得"
Command2.Caption = "相减得"
End Sub
注意:界面上有2个command,3个文本框。代码直接复制上就行了。
Private Sub Command1_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
s = a + b
Text3.Text = Str(s)
End Sub
Private Sub Command2_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
s = a - b
Text3.Text = Str(s)
End Sub
Private Sub Form_Load()
Command1.Caption = "相加得"
Command2.Caption = "相减得"
End Sub
注意:界面上有2个command,3个文本框。代码直接复制上就行了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询