vb简单的计算机源代码(20200928015139)
- 格式:docx
- 大小:14.33 KB
- 文档页数:9
VB程序简单计算器最近学完VB,感觉很好,写了个计算器程序,虽然花了不少时间,可也着实高兴。
其中遇到很多问题,最终也在各种资料中得到解决。
现在附上截图和全部代码,希望和大家交流一下,相互学习。
也希望能帮助到准备做计算器的同学。
计算器最终执行文件图标:计算器包括三个窗体(form):主页面form1:其中的“欢迎各位到此一游”是闪烁效果,呵呵,是自己想着无聊,就想出这么个玩意。
与计算器计算功能无关。
具体实现看下来代码。
Form1的实现代码:Public haha As BooleanPrivate Sub Command1_Click()Dim a As Integera = MsgBox("亲爱的你,真的想要退出本系统吗?", _vbYesNo + vbInformation + vbDefaultButton1, "退出系统前的询问撒(⊙o⊙)")If a = 6 Then '表示当选择“是”的时候的返回值EndEnd IfEnd SubPrivate Sub Command2_Click()Me.HideForm2.ShowEnd SubPrivate Sub Command3_Click()Me.HideForm3.ShowEnd SubPrivate Sub Form_Load()haha = FalseEnd SubPrivate Sub Timer1_Timer()haha = Not hahaIf haha ThenLabel2.ForeColor = &HFF00FFElseLabel2.ForeColor = vbWhiteEnd IfEnd Sub有些像图像等一些可见的控件属性就没在代码里写了,直接在属性里设置了。
页面(form2):此页面将鼠标点上去,还有意想不到的效果喲。
全部代码为:Dim isFocus1, isFocus2 As BooleanPrivate Sub Command1_Click()If isFocus1 Then '判断焦点在那个文本框中,便于实现按钮输入Text1.Text = Text1.Text & 0End IfIf isFocus2 ThenText2.Text = Text2.Text & 0End IfEnd SubPrivate Sub Command10_Click() If isFocus1 ThenText1.Text = Text1.Text & 9 End IfIf isFocus2 ThenText2.Text = Text2.Text & 9 End IfEnd SubPrivate Sub Command11_Click() If isFocus1 ThenText1.Text = Text1.Text & "." End IfIf isFocus2 ThenText2.Text = Text2.Text & "." End IfEnd SubPrivate Sub Command12_Click() If isFocus1 ThenText1.Text = -Val(Text1.Text)End IfIf isFocus2 ThenText2.Text = -Val(Text2.Text)End IfEnd SubPrivate Sub Command13_Click()Dim a As Integera = Val(Text1.Text) + Val(Text2.Text)Text3.Text = Val(Text1.Text) & "+" & Val(Text2.Text) & "=" & aIf Text1.Text = "" Or Text2.Text = "" ThenMsgBox "哼哼,双目运算一定要是两个数喔" & vbCrLf & vbCrLf & _ "不用说,补上去是必须的撒", vbCritical, "温馨小提醒(*^__^*)" End IfEnd SubPrivate Sub Command14_Click()Dim a As Integera = Val(Text1.Text) - Val(Text2.Text)Text3.Text = Val(Text1.Text) & "-" & Val(Text2.Text) & "=" & aIf Text1.Text = "" Or Text2.Text = "" ThenMsgBox "哼哼,双目运算一定要是两个数喔" & vbCrLf & vbCrLf & _ "不用说,补上去是必须的撒", vbCritical, "温馨小提醒(*^__^*)" End IfEnd SubPrivate Sub Command15_Click()a = Val(Text1.Text) * Val(Text2.Text)Text3.Text = Val(Text1.Text) & "×" & Val(Text2.Text) & "=" & aIf Text1.Text = "" Or Text2.Text = "" ThenMsgBox "哼哼,双目运算一定要是两个数喔" & vbCrLf & vbCrLf & _ "不用说,补上去是必须的撒", vbCritical, "温馨小提醒(*^__^*)" End IfEnd SubPrivate Sub Command16_Click() '除法的特殊性,除数不能为零If Val(Text2.Text) Thena = Val(Text1.Text) / Val(Text2.Text)Text3.Text = Val(Text1.Text) & "÷" & Val(Text2.Text) & "=" & aIf Text1.Text = "" Or Text2.Text = "" ThenMsgBox "哼哼,双目运算一定要是两个数喔" & vbCrLf & vbCrLf & _ "不用说,补上去是必须的撒", vbCritical, "温馨小提醒(*^__^*)" End IfElseText3.Text = "无穷大∞"MsgBox "亲,除数不可以为零的哟!", vbInformation, "矮油,不得了嘞(*^__^*)"Text2.Text = ""Text2.SetFocusEnd IfEnd SubPrivate Sub Command17_Click() '实现清零,并将焦点给文本框1Text1.Text = ""Text2.Text = ""Text3.Text = ""Text1.SetFocusEnd SubPrivate Sub Command18_Click()Me.Hide '进入计算器1Form1.ShowEnd SubPrivate Sub Command2_Click() If isFocus1 ThenText1.Text = Text1.Text & 1 End IfIf isFocus2 ThenText2.Text = Text2.Text & 1 End IfEnd SubPrivate Sub Command3_Click() If isFocus1 ThenText1.Text = Text1.Text & 2 End IfIf isFocus2 ThenText2.Text = Text2.Text & 2 End IfEnd SubPrivate Sub Command4_Click() If isFocus1 ThenText1.Text = Text1.Text & 3 End IfIf isFocus2 ThenText2.Text = Text2.Text & 3 End IfEnd SubPrivate Sub Command5_Click() If isFocus1 ThenText1.Text = Text1.Text & 4 End IfIf isFocus2 ThenText2.Text = Text2.Text & 4 End IfEnd SubPrivate Sub Command6_Click() If isFocus1 ThenText1.Text = Text1.Text & 5 End IfIf isFocus2 ThenText2.Text = Text2.Text & 5 End IfEnd SubPrivate Sub Command7_Click() If isFocus1 ThenText1.Text = Text1.Text & 6 End IfIf isFocus2 ThenText2.Text = Text2.Text & 6 End IfEnd SubPrivate Sub Command8_Click() If isFocus1 ThenText1.Text = Text1.Text & 7 End IfIf isFocus2 ThenText2.Text = Text2.Text & 7 End IfEnd SubPrivate Sub Command9_Click() If isFocus1 ThenText1.Text = Text1.Text & 8End IfIf isFocus2 ThenText2.Text = Text2.Text & 8End IfEnd SubPrivate Sub Form_Load()isFocus1 = False: isFocus2 = FalseEnd SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)Label4.ForeColor = vbBlackLabel4.FontUnderline = FalseLabel4.FontBold = FalseEnd SubPrivate Sub Label4_Click()Form3.ShowEnd SubPrivate Sub Label4_MouseMove(Button As Integer, Shift As Integer, X AsSingle, Y As Single)Label4.ForeColor = vbGreen Label4.FontUnderline = True Label4.FontBold = True End SubPrivate Sub Text1_GotFocus() isFocus1 = TrueisFocus2 = FalseEnd SubPrivate Sub Text2_GotFocus() isFocus2 = TrueisFocus1 = FalseEnd Sub页面(form3):这里面的亮点自己找哦。
VB简易计算器代码以下是一个简单的VB计算器代码:```Public Class Form1Dim firstNum As Double ' 第一个数字Dim secondNum As Double ' 第二个数字Dim operation As Integer ' 1-加法,2-减法,3-乘法,4-除法Private Sub Button0_Click(sender As Object, e As EventArgs) Handles Button0.ClickTextBoxResult.Text = TextBoxResult.Text & "0"End SubPrivate Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.ClickTextBoxResult.Text = TextBoxResult.Text & "1"End SubPrivate Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.ClickTextBoxResult.Text = TextBoxResult.Text & "2"End SubHandles Button3.ClickTextBoxResult.Text = TextBoxResult.Text & "3"End SubPrivate Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.ClickTextBoxResult.Text = TextBoxResult.Text & "4"End SubPrivate Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.ClickTextBoxResult.Text = TextBoxResult.Text & "5"End SubPrivate Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.ClickTextBoxResult.Text = TextBoxResult.Text & "6"End SubPrivate Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.ClickTextBoxResult.Text = TextBoxResult.Text & "7"End SubHandles Button8.ClickTextBoxResult.Text = TextBoxResult.Text & "8"End SubPrivate Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.ClickTextBoxResult.Text = TextBoxResult.Text & "9"End SubPrivate Sub ButtonDot_Click(sender As Object, e As EventArgs) Handles ButtonDot.ClickIf Not TextBoxResult.Text.Contains(".") ThenTextBoxResult.Text = TextBoxResult.Text & "."End IfEnd SubPrivate Sub ButtonAdd_Click(sender As Object, e As EventArgs) Handles ButtonAdd.ClickfirstNum = Double.Parse(TextBoxResult.Text)TextBoxResult.Text = ""operation = 1End SubPrivate Sub ButtonSubtract_Click(sender As Object, e As EventArgs) Handles ButtonSubtract.ClickfirstNum = Double.Parse(TextBoxResult.Text)TextBoxResult.Text = ""operation = 2End SubPrivate Sub ButtonMultiply_Click(sender As Object, e As EventArgs) Handles ButtonMultiply.ClickfirstNum = Double.Parse(TextBoxResult.Text)TextBoxResult.Text = ""operation = 3End SubPrivate Sub ButtonDivide_Click(sender As Object, e As EventArgs) Handles ButtonDivide.ClickfirstNum = Double.Parse(TextBoxResult.Text)TextBoxResult.Text = ""operation = 4End SubPrivate Sub ButtonClear_Click(sender As Object, e As EventArgs) Handles ButtonClear.ClickTextBoxResult.Text = ""End SubPrivate Sub ButtonEquals_Click(sender As Object, e As EventArgs) Handles ButtonEquals.ClickDim result As DoublesecondNum = Double.Parse(TextBoxResult.Text)Select Case operationCase 1result = firstNum + secondNumCase 2result = firstNum - secondNumCase 3result = firstNum * secondNumCase 4result = firstNum / secondNumEnd SelectTextBoxResult.Text = result.ToStringEnd SubEnd Class```这个计算器包括数字按钮0-9、小数点按钮、加法、减法、乘法、除法和等于按钮。
vb简单的计算机源代码.txt如果xx的时光在闲散中度过,那么回忆岁月将是一场凄凉的悲剧。
杂草多的地方庄稼少,空话多的地方xx少。
即使路上没有花朵,我仍可以欣赏荒芜。
Private Sub Command1_Click()Form1.Caption = "欢迎使用智能计算器"'载入默认正常显示If Check1.Value = "0" Then'1类分歧ElseIf Text1.Text = "" Or Text2.Text = "" Then'2类分歧Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then'2类分歧Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"Else'2类分歧Dim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a + bText3.Text = cText1.Text = ""Text2.Text = ""End IfIf Check1.Value = "1" Then'1类分歧ElseIf Text1.Text = "" Or Text2.Text = "" Then'2类分歧Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then'2类分歧Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"Else'2类分歧Dim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d + eText3.Text = fEnd IfEnd SubPrivate Sub Command2_Click()Form1.Caption = "欢迎使用智能计算器"If Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d - eText3.Text = fEnd IfIf Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a - bText3.Text = cText1.Text = ""Text2.Text = ""End IfEnd SubPrivate Sub Command3_Click()Form1.Caption = "欢迎使用智能计算器"If Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d * eText3.Text = fEnd IfIf Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a * bText3.Text = cText1.Text = ""Text2.Text = ""End IfEnd SubPrivate Sub Command4_Click()Form1.Caption = "欢迎使用智能计算器"If Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Val(Text2.Text) = "0" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "分数的分子不能为零"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a / bText3.Text = cText1.Text = ""Text2.Text = ""End IfIf Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Val(Text2.Text) = "0" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "分数的分子不能为零"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d / eText3.Text = fEnd IfEnd SubPrivate Sub Command5_Click()Form1.Caption = "欢迎使用智能计算器" Text1.Text = ""Text2.Text = ""Text3.Text = ""End SubPrivate Sub Command6_Click()Form1.HideForm3.ShowEnd SubPrivate Sub Command7_Click()EndEnd SubPrivate Sub Command8_Click()Form1.Caption = "欢迎使用智能计算器" If Text3.Text <> "" ThenText1.Text = Text3.TextText2.Text = ""Text3.Text = ""ElseForm1.Caption = "xataliq kuruldi"Text3.Text = "没有结果无法继续"End IfEnd SubPrivate Sub Text2_Change()End SubPrivate Sub 乘_Click()If Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d * eText3.Text = fEnd IfIf Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a * bText3.Text = cText1.Text = ""Text2.Text = ""End IfEnd SubPrivate Sub 除_Click()Form1.Caption = "欢迎使用智能计算器"If Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Val(Text2.Text) = "0" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "分数的分子不能为零"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a / bText3.Text = cText1.Text = ""Text2.Text = ""End IfIf Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "错误"Text3.Text = "运算数值不能为空"ElseIf Val(Text2.Text) = "0" ThenForm1.Caption = "错误"Text3.Text = "分数的分子不能为零"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d / eText3.Text = fEnd IfEnd SubPrivate Sub munasiwetlik_Click()Form1.Caption = "欢迎使用智能计算器" Form1.HideForm3.ShowEnd SubPrivate Sub 继续_Click()Form1.Caption = "欢迎使用智能计算器" If Text3.Text <> "" ThenText1.Text = Text3.TextText2.Text = ""Text3.Text = ""ElseForm1.Caption = "xataliq"Text3.Text = "没有结果无法继续"End IfEnd SubPrivate Sub 加_Click()Form1.Caption = "欢迎使用智能计算器"If Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "错误"Text3.Text = "运算数值不能为空"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a + bText3.Text = cText1.Text = ""Text2.Text = ""End IfIf Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d + eText3.Text = fEnd IfEnd SubPrivate Sub 减_Click()Form1.Caption = "欢迎使用智能计算器"If Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "错误"Text3.Text = "运算数值不能为空"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d - eText3.Text = fEnd IfIf Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "错误"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "错误"Text3.Text = "运算数值不能为空"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)Text3.Text = cText1.Text = ""Text2.Text = ""End IfEnd SubPrivate Sub 清空_Click()Form1.Caption = "欢迎使用智能计算器" Text1.Text = ""Text2.Text = ""Text3.Text = ""End Sub----------------------------------------------form2Private Sub Command1_Click()Form3.HideForm1.ShowForm1.Text3.Text = ""End SubPrivate Sub Command2_Click()End。
VB编程程序代码1、求100以内的素Private Sub Form_Click()Dim i%, j%For i = 2 To 100For j = 2 To i - 1If i Mod j = 0 Then Exit For Next jIf j = i Then Print iNext iEnd Sub2、从键盘输入任意长度的字符串,要求将字符顺序倒置例如,将输入的“ABCDEFG”变换成“GFEDCBA”。
Private Sub Command1_Click()Dim a$, I%, c$, d$, n%a = InputBox$("输入字符串")n = Len(a)For I = 1 To Int(n \ 2)c = Mid(a, I, 1)Mid(a, I, 1) = Mid(a, n - I + 1, 1)Mid(a, n - I + 1, 1) = cNext IPrint aEnd Sub3、计算0~200之间所有能被11或5整除的数之和Private Sub Form_Click()Dim n%, i%n = 0For i = 1 To 200If i Mod 11 = 0 Or i Mod 5 = 0 Thenn = n + iEnd IfNext iPrint nEnd Sub4、输入一年份,判断它是否为闰年,并显示有关信息。
(判断闰年的条件是:年份能被4整除但不能被100整除,或者能被400整除)Private Sub Command1_Click()Dim y%y = InputBox("请输入年数")If y Mod 4 = 0 And y Mod 100 <> 0 Or y Mod 400 = 0 Then MsgBox (y & "年是闰年")ElseMsgBox (y & "年是平年")End IfEnd Sub5、已知x,y,z 3个变量中存放了3个不同的数,比较它们的大小并进行调整,使得x<y<z。
VB 做简易计算机程序代码Private Sub Command1_Click()'每点击一下该按钮,就在文本框的尾部加字符"0"'如果txtLabel为空,则说明现在正在输入的第一个数字'负责表示输入的是第二个数字If txtLabel.Text = "" ThentxtFirst.Text = txtFirst.Text + "0"ElsetxtSecond.Text = txtSecond.Text + "0"End IfEnd SubPrivate Sub Command10_Click()If txtLabel.Text = "" ThentxtFirst.Text = txtFirst.Text + "8"ElsetxtSecond.Text = txtSecond.Text + "8"End IfEnd SubPrivate Sub Command11_Click()If txtLabel.Text = "" ThentxtFirst.Text = txtFirst.Text + "9"ElsetxtSecond.Text = txtSecond.Text + "9"End IfEnd SubPrivate Sub Command12_Click()txtLabel.Text = "加"End SubPrivate Sub Command13_Click()txtLabel.Text = "减"End SubPrivate Sub Command14_Click()txtLabel.Text = "乘"End SubPrivate Sub Command15_Click()txtLabel.Text = "除"Private Sub Command16_Click()Dim MyResult As Double '定义一个Double类型的变量.Select Case txtLabel.Text '以txtLabel.Text的值为多重分支条件Case "加" '当txtLabel.Text的值为"加"时MyResult = Val(txtFirst.Text) + Val(txtSecond.Text)Case "减" '当txtLabel.Text的值为"减"时MyResult = Val(txtFirst.Text) - Val(txtSecond.Text)Case "乘" '当txtLabel.Text的值为"乘"时MyResult = Val(txtFirst.Text) * Val(txtSecond.Text)Case "除" '当txtLabel.Text的值为"除"时MyResult = Val(txtFirst.Text) / Val(txtSecond.Text)End SelecttxtLabel.Text = "" '将txtLabel,txtSecond清空txtSecond.Text = ""txtResult.Text = MyResult '显示计算结果txtFirst.Text = txtResult.Text '将计算结果作为第一个数字,以便继续运算End SubPrivate Sub Command17_Click()txtFirst.Text = ""txtLabel.Text = ""txtSecond.Text = ""End SubPrivate Sub Command18_Click()Unload MeEnd SubPrivate Sub Command2_Click()'如果txtLabel为空,则说明现在正在输入的是第一个数字;否则表示当前正在输入的是第二个数字'转换语句的主要含义是:首先用Val函数将txtFirst.Text 转换为数字,然后再乘以-1If txtLabel.Text = "" ThentxtFirst.Text = -1 * Val(txtFirst.Text)ElsetxtSecond.Text = -1 * Val(txtSecond.Text)End IfEnd SubPrivate Sub Command3_Click()If txtLabel.Text = "" ThentxtFirst.Text = txtFirst.Text + "1"txtSecond.Text = txtSecond.Text + "1"End IfEnd SubPrivate Sub Command4_Click()If txtLabel.Text = "" ThentxtFirst.Text = txtFirst.Text + "2"ElsetxtSecond.Text = txtSecond.Text + "2"End IfEnd SubPrivate Sub Command5_Click()If txtLabel.Text = "" ThentxtFirst.Text = txtFirst.Text + "3"ElsetxtSecond.Text = txtSecond.Text + "3"End IfEnd SubPrivate Sub Command6_Click()If txtLabel.Text = "" ThentxtFirst.Text = txtFirst.Text + "4"ElsetxtSecond.Text = txtSecond.Text + "4"End IfEnd SubPrivate Sub Command7_Click()If txtLabel.Text = "" ThentxtFirst.Text = txtFirst.Text + "5"ElsetxtSecond.Text = txtSecond.Text + "5"End IfEnd SubPrivate Sub Command8_Click()If txtLabel.Text = "" ThentxtFirst.Text = txtFirst.Text + "6"ElsetxtSecond.Text = txtSecond.Text + "6"End IfEnd SubPrivate Sub Command9_Click()If txtLabel.Text = "" ThentxtFirst.Text = txtFirst.Text + "7"ElsetxtSecond.Text = txtSecond.Text + "7"End IfEnd SubPrivate Sub Form_Load()txtFirst.Text = ""txtSecond.Text = ""txtLabel.Text = ""End SubPrivate Sub m2_Click()frmAbout.Show 1 '在Show命令后加参数1,表示以模态方式显示frmAbout窗体End SubPrivate Sub Text2_Change()'每当txtFirst的内容发生变化时,将变化记过随时映射到txtResulttxtResult.Text = txtFirst.TextEnd SubPrivate Sub Text4_Change()'每当txtSecond的内容发生变化时,将变化记过随时映射到txtResulttxtResult.Text = txtSecond.TextEnd Sub。
资料范本本资料为word版本,可以直接编辑和打印,感谢您的下载VB程序代码(简单小程序)地点:__________________时间:__________________说明:本资料适用于约定双方经过谈判,协商而共同承认,共同遵守的责任与义务,仅供参考,文档可直接下载或修改,不需要的部分可直接删除,使用时请详细阅读内容实验一:(带有进度条的倒计时程序)Public Class Form1Dim timers As IntegerDim temp As IntegerPrivate Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.TickIf (ProgressBar1.Value + ProgressBar1.Maximum / timers < ProgressBar1.Maximum) ThenProgressBar1.Value += ProgressBar1.Maximum / timersElseTimer1.Enabled = FalseProgressBar1.Value = ProgressBar1.MaximumMessageBox.Show("进度完成!")End Iftemp += 1Label1.Text = temp.ToString()End SubPrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loadtimers = 30End SubPrivate Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Clicktimers = Val(InputBox("输入", "请输入总时间。
计算器vb源代码.txt性格本身没有好坏,乐观和悲观对这个世界都有贡献,前者发明了飞机,后者发明了降落伞。
完全版的前后台代码...'请把下面的保存为VERSIONBegin CalculatorBorderStyle = 1 'Fixed SingleCaption = "计算器"ClientHeight = 2970ClientLeft = 2580ClientTop = 1485ClientWidth = 3270ClipControls = 0 'FalseBeginProperty FontName = "System"Size =Charset = 0Weight = 700Underline = 0 'FalseItalic = 0 'FalseStrikethrough = 0 'FalseEndPropertyIcon = "":0000LinkMode = 1 'SourceLinkTopic = "Form1"MaxButton = 0 'FalsePaletteMode = 1 'UseZOrderScaleHeight = 2970ScaleWidth = 3270WhatsThisHelp = -1 'TrueBegin NumberCaption = "7"Height = 480Index = 7Left = 120TabIndex = 7Top = 600Width = 480EndBegin NumberCaption = "8"Height = 480Index = 8Left = 720TabIndex = 8Top = 600Width = 480 EndBegin NumberCaption = "9"Height = 480Index = 9Left = 1320TabIndex = 9Top = 600Width = 480 EndBegin CancelCaption = "C"Height = 480Left = 2040TabIndex = 10Top = 600Width = 480 EndBegin CancelEntryCaption = "CE"Height = 480Left = 2640TabIndex = 11Top = 600Width = 480 EndBegin NumberCaption = "4"Height = 480Index = 4Left = 120TabIndex = 4Top = 1200Width = 480 EndBegin NumberCaption = "5"Height = 480Index = 5Left = 720TabIndex = 5Top = 1200Width = 480 EndBegin NumberCaption = "6"Height = 480Index = 6Left = 1320TabIndex = 6Top = 1200Width = 480 EndBegin OperatorCaption = "+"Height = 480Index = 1Left = 2040TabIndex = 12Top = 1200Width = 480 EndBegin OperatorCaption = "-"Height = 480Index = 3Left = 2640TabIndex = 13Top = 1200Width = 480 EndBegin NumberCaption = "1"Height = 480Index = 1Left = 120TabIndex = 1Top = 1800Width = 480 EndBegin NumberCaption = "2"Height = 480Index = 2TabIndex = 2Top = 1800Width = 480 EndBegin NumberCaption = "3"Height = 480Index = 3Left = 1320TabIndex = 3Top = 1800Width = 480 EndBegin OperatorCaption = "X"Height = 480Index = 2Left = 2040TabIndex = 14Top = 1800Width = 480 EndBegin OperatorCaption = "/"Height = 480Index = 0Left = 2640TabIndex = 15Top = 1800Width = 480 EndBegin NumberCaption = "0"Height = 480Index = 0Left = 120TabIndex = 0Top = 2400Width = 1080 EndBegin DecimalCaption = "."Height = 480TabIndex = 18Top = 2400Width = 480EndBegin OperatorCaption = "="Height = 480Index = 4Left = 2040TabIndex = 16Top = 2400Width = 480EndBegin PercentCaption = "%"Height = 480Left = 2640TabIndex = 17Top = 2400Width = 480EndBegin ReadoutAlignment = 1 'Right JustifyBackColor = &H0000FFFF&BorderStyle = 1 'Fixed SingleCaption = "0."BeginProperty FontName = "MS Sans Serif"Size = 12Charset = 0Weight = 700Underline = 0 'FalseItalic = 0 'FalseStrikethrough = 0 'FalseEndPropertyForeColor = &H00000000&Height = 375Left = 120TabIndex = 19Top = 105Width = 3000EndEndAttribute VB_Name = "Calculator"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = False' --------------------------------------------------------------------------' 版权所有(C) 1994 Microsoft Corporation'' 您可以免费以任何方式使用、修改、复制并分发您认为有用的' 示例应用程序文件(或任何修改过的版本)。
vb简单的计算机源代码.txt如果青春的时光在闲散中度过,那么回忆岁月将是一场凄凉的悲剧。
杂草多的地方庄稼少,空话多的地方智慧少。
即使路上没有花朵,我仍可以欣赏荒芜。
Private Sub Command1_Click()Form1.Caption = "欢迎使用智能计算器" '载入默认正常显示If Check1.Value = "0" Then '1类分歧ElseIf Text1.Text = "" Or Text2.Text = "" Then '2类分歧Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then '2类分歧Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"Else '2类分歧Dim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a + bText3.Text = c页脚内容1Text1.Text = ""Text2.Text = ""End IfIf Check1.Value = "1" Then '1类分歧ElseIf Text1.Text = "" Or Text2.Text = "" Then '2类分歧Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then '2类分歧Form1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"Else '2类分歧Dim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d + eText3.Text = f页脚内容2End IfEnd SubPrivate Sub Command2_Click()Form1.Caption = "欢迎使用智能计算器"If Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d - e页脚内容3Text3.Text = fEnd IfIf Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a - bText3.Text = cText1.Text = ""页脚内容4Text2.Text = ""End IfEnd SubPrivate Sub Command3_Click()Form1.Caption = "欢迎使用智能计算器"If Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)页脚内容5f = d * eText3.Text = fEnd IfIf Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a * bText3.Text = cText1.Text = ""页脚内容6Text2.Text = ""End IfEnd SubPrivate Sub Command4_Click()Form1.Caption = "欢迎使用智能计算器"If Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Val(Text2.Text) = "0" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "分数的分子不能为零"Else页脚内容7Dim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a / bText3.Text = cText1.Text = ""Text2.Text = ""End IfIf Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Val(Text2.Text) = "0" ThenForm1.Caption = "xataliq kuruldi"页脚内容8Text3.Text = "分数的分子不能为零"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d / eText3.Text = fEnd IfEnd SubPrivate Sub Command5_Click()Form1.Caption = "欢迎使用智能计算器"Text1.Text = ""Text2.Text = ""Text3.Text = ""End Sub页脚内容9Private Sub Command6_Click()Form1.Caption = "欢迎使用智能计算器"Form1.HideForm3.ShowEnd SubPrivate Sub Command7_Click()EndEnd SubPrivate Sub Command8_Click()Form1.Caption = "欢迎使用智能计算器"If Text3.Text <> "" ThenText1.Text = Text3.TextText2.Text = ""Text3.Text = ""页脚内容10ElseForm1.Caption = "xataliq kuruldi"Text3.Text = "没有结果无法继续"End IfEnd SubPrivate Sub Text2_Change()End SubPrivate Sub 乘_Click()Form1.Caption = "欢迎使用智能计算器"If Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"页脚内容11Text3.Text = "运算数值不能为空"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d * eText3.Text = fEnd IfIf Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseDim a, b, c As Double页脚内容12a = Val(Text1.Text)b = Val(Text2.Text)c = a * bText3.Text = cText1.Text = ""Text2.Text = ""End IfEnd SubPrivate Sub 除_Click()Form1.Caption = "欢迎使用智能计算器"If Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"页脚内容13Text3.Text = "运算数值不能为空"ElseIf Val(Text2.Text) = "0" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "分数的分子不能为零"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a / bText3.Text = cText1.Text = ""Text2.Text = ""End IfIf Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"页脚内容14ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "错误"Text3.Text = "运算数值不能为空"ElseIf Val(Text2.Text) = "0" ThenForm1.Caption = "错误"Text3.Text = "分数的分子不能为零"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d / eText3.Text = fEnd IfEnd SubPrivate Sub munasiwetlik_Click()Form1.Caption = "欢迎使用智能计算器"页脚内容15Form1.HideForm3.ShowEnd SubPrivate Sub 继续_Click()Form1.Caption = "欢迎使用智能计算器"If Text3.Text <> "" ThenText1.Text = Text3.TextText2.Text = ""Text3.Text = ""ElseForm1.Caption = "xataliq"Text3.Text = "没有结果无法继续"End IfEnd SubPrivate Sub 加_Click()Form1.Caption = "欢迎使用智能计算器"页脚内容16If Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "错误"Text3.Text = "运算数值不能为空"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a + bText3.Text = cText1.Text = ""Text2.Text = ""End IfIf Check1.Value = "1" Then页脚内容17ElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d + eText3.Text = fEnd IfEnd SubPrivate Sub 减_Click()Form1.Caption = "欢迎使用智能计算器"页脚内容18If Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "错误"Text3.Text = "运算数值不能为空"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d - eText3.Text = fEnd IfIf Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" ThenForm1.Caption = "错误"页脚内容19Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "错误"Text3.Text = "运算数值不能为空"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a - bText3.Text = cText1.Text = ""Text2.Text = ""End IfEnd SubPrivate Sub 清空_Click()Form1.Caption = "欢迎使用智能计算器"页脚内容20Text1.Text = ""Text2.Text = ""Text3.Text = ""End Sub----------------------------------------------form2 ?? ???? ??????Private Sub Command1_Click()Form3.HideForm1.ShowForm1.Text3.Text = ""End SubPrivate Sub Command2_Click()End页脚内容21End Sub页脚内容22。
vb 简单的计算机源代码.txt 如果青春的时光在闲散中度过,那么回忆岁月将是一场凄凉的悲剧。
杂草多的地方庄稼少,空话多的地方智慧少。
即使路上没有花朵,我仍可以欣赏荒芜。
Private Sub Command1_Click()Form1.Caption = " 欢迎使用智能计算器"If Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi" Text3.Text = " 运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空" Else '2 Dim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a + bText3.Text = c Text1.Text = "" Text2.Text = "" End IfIf Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空" ElseIf Text1.Text = "" And Text2.Text = "" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空" Else '2 Dim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d + eText3.Text = fEnd IfEnd SubPrivate Sub Command2_Click() Form1.Caption = " 欢迎使用智能计算器"If Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi" Text3.Text = " 运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then1 载入默认正常显'1 类分歧'2 类分歧'2 类分歧类分歧'1 类分歧'2 类分歧'2 类分歧类分歧Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d - eText3.Text = fEnd IfIf Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a - bText3.Text = cText1.Text = ""Text2.Text = ""End IfEnd SubPrivate Sub Command3_Click() Form1.Caption = " 欢迎使用智能计算器"If Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d * eText3.Text = fEnd IfIf Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a * bText3.Text = cText1.Text = ""Text2.Text = ""End IfEnd SubPrivate Sub Command4_Click() Form1.Caption = " 欢迎使用智能计算器"If Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseIf Val(Text2.Text) = "0" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = " 分数的分子不能为零"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a / bText3.Text = cText1.Text = ""Text2.Text = ""End IfIf Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi" Text3.Text = "运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseIf Val(Text2.Text) = "0" ThenForm1.Caption = "xataliq kuruldi" Text3.Text = " 分数的分子不能为零ElseDim d, e, f As Double d = Val(Text1.Text) e = Val(Text2.Text) f = d / eText3.Text = fEnd IfEnd SubPrivate Sub Command5_Click()Form1.Caption = " 欢迎使用智能计算器Text1.Text = ""Text2.Text = ""Text3.Text = ""End SubPrivate Sub Command6_Click()Form1.Caption = " 欢迎使用智能计算器Form1.HideForm3.ShowEnd SubPrivate Sub Command7_Click()EndEnd SubPrivate Sub Command8_Click()Form1.Caption = " 欢迎使用智能计算器If Text3.Text <> "" ThenText1.Text = Text3.TextText2.Text = ""Text3.Text = ""ElseForm1.Caption = "xataliq kuruldi"Text3.Text = " 没有结果无法继续"End IfEnd SubPrivate Sub Text2_Change()End SubPrivate Sub 乘_Click()Form1.Caption = " 欢迎使用智能计算器"If Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi" Text3.Text = " 运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d * eText3.Text = fEnd IfIf Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a * bText3.Text = cText1.Text = ""Text2.Text = ""End IfEnd SubPrivate Sub 除_Click()Form1.Caption = " 欢迎使用智能计算器If Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi" Text3.Text = " 运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseIf Val(Text2.Text) = "0" ThenForm1.Caption = "xataliq kuruldi"Text3.Text = " 分数的分子不能为零"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a / bText3.Text = cText1.Text = ""Text2.Text = ""End IfIf Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi" Text3.Text = " 运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = " 错误"Text3.Text = " 运算数值不能为空"ElseIf Val(Text2.Text) = "0" ThenForm1.Caption = " 错误"Text3.Text = " 分数的分子不能为零"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d / eText3.Text = fEnd IfEnd SubPrivate Sub munasiwetlik_Click()Form1.Caption = " 欢迎使用智能计算器Form1.HideForm3.ShowEnd SubPrivate Sub 继续_Click()Form1.Caption = " 欢迎使用智能计算器IIIf Text3.Text <> "" ThenText1.Text = Text3.TextText2.Text = ""Text3.Text = ""ElseForm1.Caption = "xataliq"Text3.Text = " 没有结果无法继续"End IfEnd SubPrivate Sub 加_Click()Form1.Caption = " 欢迎使用智能计算器"If Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = " 错误"Text3.Text = " 运算数值不能为空"ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a + bText3.Text = cText1.Text = ""Text2.Text = ""End IfIf Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = "xataliq kuruldi"Text3.Text = " 运算数值不能为空"ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d + eText3.Text = fEnd IfEnd SubPrivate Sub 减 _Click()Form1.Caption = " 欢迎使用智能计算器 " If Check1.Value = "1" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = "xataliq kuruldi" Text3.Text = " 运算数值不能为空 "ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = " 错误 "Text3.Text = " 运算数值不能为空 "ElseDim d, e, f As Doubled = Val(Text1.Text)e = Val(Text2.Text)f = d - eText3.Text = fEnd IfIf Check1.Value = "0" ThenElseIf Text1.Text = "" Or Text2.Text = "" Then Form1.Caption = " 错误 "Text3.Text = " 运算数值不能为空 "ElseIf Text1.Text = "" And Text2.Text = "" Then Form1.Caption = " 错误 "Text3.Text = " 运算数值不能为空 "ElseDim a, b, c As Doublea = Val(Text1.Text)b = Val(Text2.Text)c = a - bText3.Text = cText1.Text = ""Text2.Text = ""End IfEnd SubEnd SubPrivate Sub Form1.Caption = " Text1.Text = ""Text2.Text = ""Text3.Text = ""清空 _Click()欢迎使用智能计算器form2 ?? ???? ??????Private Sub Command1_Click() Form3.HideForm1.ShowForm1.Text3.Text = ""End SubPrivate Sub Command2_Click() EndEnd Sub。