| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1470 人关注过本帖
标题:求助]用vb编写一个计算器
只看楼主 加入收藏
xiongyi
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-5-21
收藏
 问题点数:0 回复次数:0 
求助]用vb编写一个计算器

求助]vb编写一个计算器

小弟是初学者 只会最简单的 单步 加减乘除

哪位 大大 能帮我完善完善计算器功能 比如 连续运算,储存调用数据 之类

万分感谢

代码是:Option Explicit
Dim c As Boolean
Dim cc As Boolean
Dim ccc As String
Dim cccc As String
Dim ccccc As String


Private Sub Command1_Click()
CommonDialog1.DialogTitle = "打开一幅图片"
CommonDialog1.Action = 1
Image1.Picture = LoadPicture(CommonDialog1.FileName)
Image1.Visible = True
End Sub

Private Sub Command2_Click(Index As Integer)

If c = False Then
Select Case Index
Case 1
Text1.Text = Text1.Text & "1"
Case 2
Text1.Text = Text1.Text & "2"
Case 3
Text1.Text = Text1.Text & "3"
Case 4
Text1.Text = Text1.Text & "4"
Case 5
Text1.Text = Text1.Text & "5"
Case 6
Text1.Text = Text1.Text & "6"
Case 7
Text1.Text = Text1.Text & "7"
Case 8
Text1.Text = Text1.Text & "8"
Case 9
Text1.Text = Text1.Text & "9"
Case 0
Text1.Text = Text1.Text & "0"
End Select
cccc = Text1.Text
End If
c = False
End Sub

Private Sub Command3_Click()
If cc = False Then
Text1.Text = Text1.Text & "."

End If
c = False
cc = True
End Sub

Private Sub Command5_Click(Index As Integer)

c = False
cc = False
Select Case Index
Case 0
ccc = "+"
Case 1
ccc = "-"
Case 2
ccc = "*"
Case 3
ccc = "/"
End Select
'将变量cccc的值赋予变量ccccc , 使变量ccccc作为第一个输入的数字
'并让程序在此单击事件中记住第一个数字,同时清空text1.text,还原变量c
'和变量cc,c和cc是两个标示符,还原的目的是不影响第二个数字的输入。
ccccc = cccc
Text1.Text = ""
c = False
cc = False

End Sub

Private Sub Command6_Click()

Select Case ccc
Case "+"
Text1.Text = Val(ccccc) + Val(cccc)
Case "-"
Text1.Text = Val(ccccc) - Val(cccc)
Case "*"
Text1.Text = Val(ccccc) * Val(cccc)
Case "/"
Text1.Text = Val(ccccc) / Val(cccc)
End Select
End Sub

Private Sub Command7_Click()
Text1.Text = ""
c = False
cc = False
End Sub

Private Sub Form_Load()
c = False
cc = False
End Sub


搜索更多相关主题的帖子: 计算器 编写 
2006-05-21 13:51
快速回复:求助]用vb编写一个计算器
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.039232 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved