| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 729 人关注过本帖
标题:第一次学VB,自己做的简单计算器
取消只看楼主 加入收藏
giver23
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2006-11-22
收藏
 问题点数:0 回复次数:0 
第一次学VB,自己做的简单计算器

Dim c As String
Dim f1 As Double, f2 As Double, f As Double, x As Integer

Private Sub Command1_Click()
Text1.Text = 0
c = ""

f1 = 0
f2 = 0
f = 0


End Sub

Private Sub Command10_Click()
Dim c2 As String
c2 = 2
c = c + c2
Text1.Text = c
f1 = Val(c)
End Sub

Private Sub Command11_Click()
Dim c3 As String
c3 = 3
c = c + c3
Text1.Text = c
f1 = Val(c)
End Sub

Private Sub Command12_Click()
Dim c0 As String
c0 = 0
If Val(Text1.Text) = 0 Then
Text1.Text = 0
c = ""

Else


c = c + c0

Text1.Text = c
End If


f1 = Val(c)
End Sub

Private Sub Command13_Click()
f1 = -f1
Text1.Text = f1
End Sub

Private Sub Command14_Click()
Dim c10 As String
If f = 0 Then

c10 = "."
If Text1.Text = 0 Then
c = "0."
Text1.Text = c
Else
c = c + c10
Text1.Text = c
f1 = Val(c)
End If

Else
c = "0."
Text1.Text = c
End If




End Sub

Private Sub Command15_Click()
x = 4
c = ""
f2 = Val(Text1.Text)

End Sub

Private Sub Command16_Click()
x = 3
c = ""
f2 = Val(Text1.Text)
End Sub

Private Sub Command17_Click()
x = 1
c = ""
f2 = Val(Text1.Text)


End Sub

Private Sub Command18_Click()
x = 2
c = ""
f2 = Val(Text1.Text)
End Sub

Private Sub Command19_Click()
f = Sqr(Text1.Text)
Text1.Text = f
c = ""
End Sub

Private Sub Command2_Click()
End

End Sub

Private Sub Command20_Click()
f = Val(Text1.Text) * Val(Text1.Text)
Text1.Text = f
c = ""

End Sub

Private Sub Command21_Click()
f = Val(Text1.Text) * Val(Text1.Text) * Val(Text1.Text)
Text1.Text = f
c = ""

End Sub

Private Sub Command22_Click()

Select Case x
Case 1
f = f1 + f2
Text1.Text = f
Case 2
f = f2 - f1
Text1.Text = f
Case 3
f = f2 * f1
Text1.Text = f
Case 4
f = f2 / f1
Text1.Text = f

End Select

End Sub

Private Sub Command3_Click()
Dim c7 As String
c7 = "7"
c = c + c7
Text1.Text = c
f1 = Val(c)
End Sub

Private Sub Command4_Click()
Dim c8 As String
c8 = 8
c = c + c8
Text1.Text = c
f1 = Val(c)

End Sub

Private Sub Command5_Click()
Dim c9 As String
c9 = 9
c = c + c9
Text1.Text = c
f1 = Val(c)
End Sub

Private Sub Command6_Click()
Dim c4 As String
c4 = 4
c = c + c4
Text1.Text = c
f1 = Val(c)
End Sub

Private Sub Command7_Click()
Dim c5 As String
c5 = 5
c = c + c5
Text1.Text = c
f1 = Val(c)
End Sub

Private Sub Command8_Click()
Dim c6 As String
c6 = 6
c = c + c6
Text1.Text = c
f1 = Val(c)
End Sub

Private Sub Command9_Click()
Dim c1 As String
c1 = 1
c = c + c1
Text1.Text = c
f1 = Val(c)
End Sub



这个程序是自己第一次学 VB写的,很多都是可以改进的!

3XtOwuJS.rar (5.15 KB) 第一次学VB,自己做的简单计算器


搜索更多相关主题的帖子: 计算器 
2006-11-22 22:53
快速回复:第一次学VB,自己做的简单计算器
数据加载中...
 
   



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

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