ZKX's LAB

vb标准计算器程序

2021-04-09知识2

VB怎么编程序:[1]怎么编写一个计算器程序,菜鸟入门学VB可通过此实例初步了解VB,举一反三慢慢深入了解。本篇中的计算器是简化的,只能通过输入数值X,Y,使两者相加求和。。

vb程序 计算器 Dim a As Double,b As Double,c As Double,d As Double,e As Double,f As Double,g As Double,h As Double,jg1 As Double,jg2 As Double,jg3 As Doublejg4 As DoublePrivate Sub Command1_Click()jg=a*bText3.Text=jgEnd SubPrivate Sub Command2_Click()jg2=c/dText6.Text=jg2End SubPrivate Sub Command3_Click()jg3=e+fText9.Text=jg3End SubPrivate Sub Command4_Click()jg4=g-hText12.Text=jg4End SubPrivate Sub Command5_Click()Text1.Text=\"Text2.Text=\"Text3.Text=\"End SubPrivate Sub Command6_Click()Text4.Text=\"Text5.Text=\"Text6.Text=\"End SubPrivate Sub Command7_Click()Text7.Text=\"Text8.Text=\"Text9.Text=\"End SubPrivate Sub Command8_Click()Text10.Text=\"Text11.Text=\"Text12.Text=\"End SubPrivate Sub Command9_Click()Text1.Text=\"Text2.Text=\"Text3.Text=\"Text4.Text=\"Text5.Text=\"Text6.Text=\"Text7.Text=\"Text8.Text=\"Text9.Text=\"Text10.Text=\"Text11.Text=\"Text12.Text=\"End SubPrivate Sub Text1_Change()a=val(Text1.Text)End SubPrivate Sub Text10_Change()g=val(Text10。

用VB编写简单计算器程序 以下是关键代码:Rem 判断文本框输入是否正确,可添加在“计算”按钮代码中If IsNumeric(Text1.Text)=False Then '判断是否是数字Msgbox\"错误\",16,\"错误提示Text1.SetFocusEnd IfIf IsNumeric(Text2.Text)=False ThenMsgbox\"错误\",16,\"错误提示Text2.SetFocusEnd IfRem 计算,可添加在“计算”按钮代码中Select Case Text3.TextCase\"+Text4.text=Val(Text1.Text)+Val(Text2.Text)Case\"-Text4.text=Val(Text1.Text)-Val(Text2.Text)Case\"*Text4.text=Val(Text1.Text)*Val(Text2.Text)Case\"/Text4.text=Val(Text1.Text)/Val(Text2.Text)Case ElseMsgbox\"错误\",16,\"错误提示Text3.SetFocusEnd SelectRem 结束,可添加在“结束”按钮代码中End希望能对你有帮助

#怎么用vb.net做计算器#vb计算器代码#vb简单计算器编程代码附图文库#怎么用vb做计算器#用vb做计算器

随机阅读

qrcode
访问手机版