怎样用vb6制做简易计算器

来源:百度知道 编辑:UC知道 时间:2024/05/07 10:08:20
只需一个文本框;+,-,*,/,=与清零六个按钮就行了。
请详细解说,因为本人在此之前没有接触过vb
具体每个按钮的代码是什么。比如编写“+”号的代码时双击“+”号按钮而出现的代码编写框中应写怎样的代码。

390744755 :复制我的代码 也要说一声么。。。

而且他只要1个文本框 +-*/ = 和清0 ,所以这个应该是要 表达式计算的。。

参考这两篇把
http://hi.baidu.com/54t%5Ft54/blog/item/4d5c734a17a5f72009f7efe7.html
http://hi.baidu.com/54t%5Ft54/blog/item/3f4ed5249f7c0a024d088d03.html

Option Explicit
Dim index1 As Integer, b As Single, a As Single, index2 As Integer, c As Integer

Private Sub Command1_Click(Index As Integer)
Dim ab As Integer

For index1 = 0 To 9
If Index = index1 Then
Text1.SelText = index1
b = Val(Text1.Text)
End If
Next index1
'-------------------------数字部分(上面的是0-9的数字)-----------------

For index2 = 11 To 14
If Index = index2 Then
c = index2
a = b