关于vb编程的一些问题

[复制链接]
查看11 | 回复3 | 2008-1-26 16:47:37 | 显示全部楼层 |阅读模式
a,b,c,d是加减乘除,按钮数组为0-9,command7为显示字串(a + b) * c * d可是你想问什么?
回复

使用道具 举报

千问 | 2008-1-26 16:47:37 | 显示全部楼层
where are your questions?
回复

使用道具 举报

千问 | 2008-1-26 16:47:37 | 显示全部楼层

回复

使用道具 举报

千问 | 2008-1-26 16:47:37 | 显示全部楼层
我查到问题了:你在单击+-*/按钮时,先用的清除lable1然后再取值,当然每次取到的值是空的值啦。知道了吗。举例:原来的代码:
Label1.Caption = ""
a = a + Val(Label1.Caption) 正确代码:
a = a + Val(Label1.Caption)
Label1.Caption = "" 把每一个运算符的单击代码都改一下吧~给你正确的全部的完整的代码:Public a#, b#, c#, d#Private Sub Command1_Click(Index As Integer)Select Case IndexCase 0Label1.Caption = Label1.Caption + "1"Case 1Label1.Caption = Label1.Caption + "2"Case 2Label1.Caption = Label1.Caption + "3"Case 3Label1.Caption = Label1.Caption + "4"Case 4Label1.Caption = Label1.Caption + "5"Case 5Label1.Caption = Label1.Caption + "6"Case 6Label1.Caption = Label1.Caption + "7"Case 7Label1.Caption = Label1.Caption + "8"Case 8Label1.Caption = Label1.Caption + "9"Case 9Label1.Caption = Label1.Caption + "0"Case 10Label1.Caption = Label1.Caption + "."End SelectEnd SubPrivate Sub Command2_Click()a = 0#: b = 0#: c = 1#: d = 1#Label1.Caption = ""End SubPrivate Sub Command3_Click()Debug.PrintEnd SubPrivate Sub Command4_Click()b = b - Val(Label1.Caption)Label1.Caption = ""End SubPrivate Sub Command5_Click()c = c * Val(Label1.Caption)Label1.Caption = ""End SubPrivate Sub Command6_Click()d = d / Val(Label1.Caption)Label1.Caption = ""End SubPrivate Sub Command7_Click()Label1.Caption = (a + b) * c * dEnd Sub
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行