VB编程.......................

[复制链接]
查看11 | 回复4 | 2010-6-11 11:19:53 | 显示全部楼层 |阅读模式
Private Sub Command6_Click()
Dim a As Integer
Dim b As Integer
a = Val(Text4.Text) * (((Val(Text4.Text) / Text3.Text) ^ (1 / 3) + Val(Text5.Text)) / 2)
Text6.Text = a
b = Val(Text6.Text) / Val(Text7.Text)
Text8.Text = b
End Sub
怎么出错呢

回复

使用道具 举报

千问 | 2010-6-11 11:19:53 | 显示全部楼层
dim a as float;a=Val(Text4.Text) * (((Val(Text4.Text) / val(Text3.Text) ^ (1 / 3) + Val(Text5.Text)) / 2);c=val(text7.text);b=a/c;还有前面几个text里面一定要有有效数据,否则默认为零就必然出错
回复

使用道具 举报

千问 | 2010-6-11 11:19:53 | 显示全部楼层
a = Val(Text4.Text) * (((Val(Text4.Text) / Text3.Text) ^ (1 / 3) + Val(Text5.Text)) / 2)你定义的a 是integer 而赋值的时候却可能是 double float型!!b也是这样。
回复

使用道具 举报

千问 | 2010-6-11 11:19:53 | 显示全部楼层
帮你小小测试了一下。这里可能是因为你text7值的问题。你的text4,3,5,7一定要有数值。。。
回复

使用道具 举报

千问 | 2010-6-11 11:19:53 | 显示全部楼层
把a赋值那句的text3.text也用val包含起来。
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行