跪求高手,有没有用vb写的计算器程序啊,只要简单的+-*/功能
解决方案 »
- MSFlexGrid1控件的某列能不能设置打勾选中的功能?
- 这个问题困扰我好几天,各位帮帮忙(100分)!!!
- vb 中有没有一个属性使一个FORM始终显示在最前呢?
- 请问SQLServer数据更新速度与系统配置之间关系的问题
- vb中ado的开放锁的一个奇怪问题?还请各位帮忙解释一下
- 这个是托盘程序代码 ,代码中.dwState = 0是什么意思呀?
- 这种软件怎摸做?
- 请问如何用SQL语句把表的结构导出到另一个表?
- 能否推荐一个比较好得VB教学站,最好是人多且有聊天室得,我初学。
- 如何使用printform方法,打印宽度,长度的调整
- 關於activereport調用sql2000存儲過程的呾
- 急:如何确认在EXCEL文件中使用查找命令找到要找的单元格,同时返回该单元格的行号和列号!
'用VB打开改文件,运行VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "Calc"
ClientHeight = 3195
ClientLeft = 45
ClientTop = 330
ClientWidth = 3495
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 3495
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton CommandOperator
Height = 465
Index = 4
Left = 2490
TabIndex = 15
Top = 2370
Width = 645
End
Begin VB.CommandButton CommandOperator
Height = 465
Index = 3
Left = 2490
TabIndex = 14
Top = 1830
Width = 645
End
Begin VB.CommandButton CommandOperator
Height = 465
Index = 2
Left = 2490
TabIndex = 13
Top = 1260
Width = 645
End
Begin VB.CommandButton CommandOperator
Height = 465
Index = 1
Left = 2490
TabIndex = 12
Top = 720
Width = 645
End
Begin VB.CommandButton CommandOperator
Height = 465
Index = 0
Left = 1020
TabIndex = 11
Top = 2370
Width = 1365
End
Begin VB.CommandButton CommandButton
Height = 465
Index = 9
Left = 1740
TabIndex = 10
Top = 1830
Width = 645
End
Begin VB.CommandButton CommandButton
Height = 465
Index = 8
Left = 1020
TabIndex = 9
Top = 1830
Width = 645
End
Begin VB.CommandButton CommandButton
Height = 465
Index = 7
Left = 300
TabIndex = 8
Top = 1830
Width = 645
End
Begin VB.CommandButton CommandButton
Height = 465
Index = 6
Left = 1740
TabIndex = 7
Top = 1260
Width = 645
End
Begin VB.CommandButton CommandButton
Height = 465
Index = 5
Left = 1020
TabIndex = 6
Top = 1260
Width = 645
End
Begin VB.CommandButton CommandButton
Height = 465
Index = 4
Left = 300
TabIndex = 5
Top = 1260
Width = 645
End
Begin VB.CommandButton CommandButton
Height = 465
Index = 3
Left = 1740
TabIndex = 4
Top = 720
Width = 645
End
Begin VB.CommandButton CommandButton
Height = 465
Index = 2
Left = 1020
TabIndex = 3
Top = 720
Width = 645
End
Begin VB.CommandButton CommandButton
Height = 465
Index = 1
Left = 300
TabIndex = 2
Top = 720
Width = 645
End
Begin VB.CommandButton CommandButton
Height = 465
Index = 0
Left = 300
TabIndex = 1
Top = 2370
Width = 645
End
Begin VB.TextBox Text1
Alignment = 1 'Right Justify
Height = 285
Left = 300
Locked = -1 'True
TabIndex = 0
Text = "0"
Top = 300
Width = 2865
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option ExplicitDim Num As Long
Dim Operator As Long
Dim Reset As BooleanPrivate Sub Form_Load()
With Form1
.Left = (Screen.Width - .Width) / 2
.Top = (Screen.Height - .Height) / 2
End With
Dim i As Long
For i = 0 To 9
CommandButton(i).Caption = CStr(i)
Next i
CommandOperator(0).Caption = "="
CommandOperator(1).Caption = "+"
CommandOperator(2).Caption = "-"
CommandOperator(3).Caption = "*"
CommandOperator(4).Caption = "/"
End SubPrivate Sub CommandButton_Click(Index As Integer)
If Reset = True Then
Text1.Text = "0"
Reset = False
End If
Text1.Text = Val(Text1.Text & Index)
End SubPrivate Sub CommandOperator_Click(Index As Integer)
Select Case Index
Case 0
Select Case Operator
Case 1
Text1.Text = Num + Val(Text1.Text)
Case 2
Text1.Text = Num - Val(Text1.Text)
Case 3
Text1.Text = Num * Val(Text1.Text)
Case 4
Text1.Text = Num / Val(Text1.Text)
End Select
Num = 0
Operator = 0
Reset = True
Case 1, 2, 3, 4
Num = Val(Text1.Text)
Text1.Text = "0"
Operator = Index
End Select
End Sub