求用vb6。0写的计算器(给分100)
只要求会+ - × ÷
可以发到
万分感谢!
只要求会+ - × ÷
可以发到
万分感谢!
解决方案 »
- VB BeforeNavigate2 事件问题 急急急
- 工具求助111
- 请问,我要实现这些功能,要学什么语言好呢?
- 怎样才能做到SQL server和自己的程序一起发布?(怎样才能做到SQL Server集成到VB安装程序)在别的电脑上不用独立在安装SQL server.谢谢
- 关于Source Safe 的问题: 一问20分行吗
- 如何保存图片某部分?
- 在同一工程多个窗体中使用Webbrowser登录某个网站的不同帐户
- how to use media player control to open a file via HTTP in Win2k?
- 超级难题!~~~大家快来
- datareport.printreport 为何只打印一页?
- 再问用vb打开powerpoint文档。难道大家只会word和excel吗?
- 百思不得其解,怎么可能会这样呢??????
http://expert.csdn.net/Expert/topic/2899/2899641.xml?temp=6.206912E-02
Dim Op1, Op2 ' Previously input operand.
Dim firstInput As Boolean ' Indicate type of last keypress event.
Dim OpFlag, lastinput ' Indicate pending operation.
Private Sub Form_Load() Dim i As Integer, NumWidth As Integer
NumWidth = (number(0).Width)
For i = 1 To 9
Load number(i)
If i Mod 3 = 1 Then
number(i).Top = number(i - 1).Top - number(i - 1).Height - 100
number(i).Left = number(0).Left
Else
number(i).Top = number(i - 1).Top
number(i).Left = number(i - 1).Left + number(i - 1).Width + 100
End If
number(i).Caption = i
number(i).Visible = -1
Next i
number(0).Width = number(1).Width * 3 + 100
firstInput = True
lastinput = ""
End SubPrivate Sub Clea_Click()
Disp = Format(0, "0")
Op1 = 0
Op2 = 0
firstInput = True
lastinput = ""
End Sub
Private Sub Number_Click(Index As Integer)
If lastinput <> "NUMS" Then
Disp = number(Index).Caption
Else
Disp = Disp + number(Index).Caption
End If
lastinput = "NUMS"
End Sub
Private Sub Operator_Click(Index As Integer)
If firstInput = True Then
Op1 = Val(Disp)
firstInput = False
Else
Op2 = Val(Disp)
Select Case OpFlag
Case "+"
Op1 = Op1 + Op2
Case "-"
Op1 = Op1 - Op2
Case "℅"
Op1 = Op1 * Op2
Case "¯"
If Op2 = 0 Then
MsgBox "Can't divide by zero", 48, "Calculator"
Else
Op1 = Op1 / Op2
End If
End Select
If Operator(Index).Caption = "=" Then Disp = Op1
End If
lastinput = "oper"
OpFlag = Operator(Index).Caption
End SubPrivate Sub tran_Click(Index As Integer)
Select Case Index
Case 0
Disp = Oct(Val(Disp))
Case 1
Disp = Hex(Val(Disp))
End Select
End Sub
希望大家继续发!
谢谢!
[email protected]