vb实时错误6
PrivateSubCommand1_Click()Dima(12)AsLonga(1)=Val(Text1.Text)'该实验的D,H总共各要输入六个测量值a(2)=V...
Private Sub Command1_Click()
Dim a(12) As Long
a(1) = Val(Text1.Text) '该实验的D,H总共各要输入六个测量值
a(2) = Val(Text2.Text)
a(3) = Val(Text3.Text)
a(4) = Val(Text4.Text)
a(5) = Val(Text5.Text)
a(6) = Val(Text6.Text)
a(7) = Val(Text7.Text)
a(8) = Val(Text8.Text)
a(9) = Val(Text9.Text)
a(10) = Val(Text10.Text)
a(11) = Val(Text11.Text)
a(12) = Val(Text12.Text)
aa = 0
For i = 1 To 6 '该实验的D,H各六个测量值的平均值
aa = a(i) + aa
Next i
av1 = aa / 6
bb = o
For i = 7 To 12
bb = a(i) + bb
Next i
av2 = bb / 6
cc = o '计算D、H的A类不确定度
For i = 7 To 12
cc = (a(i) - av2) ^ 2 + cc
Next i
m1 = cc / 5
dd = o
For i = 1 To 6
dd = (a(i) - av1) ^ 2 + dd
Next i
m2 = dd / 5
zbq1 = (m1 + (0.00002) ^ 2 / 3) ^ 0.5 '计算D、H的B类不确定度
zbq2 = (m2 + (0.0001) ^ 2 / 3) ^ 0.5
Text13.Text = zbq1
Text14.Text = zbq2
End Sub
Private Sub Command2_Click() '密度的不确定度
Dim bt As Double
g1 = Val(Text16.Text)
bt = g1 * ((0.00002 / 3) + (2 * m1 / av2) ^ 2 + (m2 / av1) ^ 2) ^ 0.5
Text15.Text = bt
End Sub
Private Sub h1_Click()
Form3.Hide
form1.Show
End Sub
还是在计算bt那里溢出了!!! 展开
Dim a(12) As Long
a(1) = Val(Text1.Text) '该实验的D,H总共各要输入六个测量值
a(2) = Val(Text2.Text)
a(3) = Val(Text3.Text)
a(4) = Val(Text4.Text)
a(5) = Val(Text5.Text)
a(6) = Val(Text6.Text)
a(7) = Val(Text7.Text)
a(8) = Val(Text8.Text)
a(9) = Val(Text9.Text)
a(10) = Val(Text10.Text)
a(11) = Val(Text11.Text)
a(12) = Val(Text12.Text)
aa = 0
For i = 1 To 6 '该实验的D,H各六个测量值的平均值
aa = a(i) + aa
Next i
av1 = aa / 6
bb = o
For i = 7 To 12
bb = a(i) + bb
Next i
av2 = bb / 6
cc = o '计算D、H的A类不确定度
For i = 7 To 12
cc = (a(i) - av2) ^ 2 + cc
Next i
m1 = cc / 5
dd = o
For i = 1 To 6
dd = (a(i) - av1) ^ 2 + dd
Next i
m2 = dd / 5
zbq1 = (m1 + (0.00002) ^ 2 / 3) ^ 0.5 '计算D、H的B类不确定度
zbq2 = (m2 + (0.0001) ^ 2 / 3) ^ 0.5
Text13.Text = zbq1
Text14.Text = zbq2
End Sub
Private Sub Command2_Click() '密度的不确定度
Dim bt As Double
g1 = Val(Text16.Text)
bt = g1 * ((0.00002 / 3) + (2 * m1 / av2) ^ 2 + (m2 / av1) ^ 2) ^ 0.5
Text15.Text = bt
End Sub
Private Sub h1_Click()
Form3.Hide
form1.Show
End Sub
还是在计算bt那里溢出了!!! 展开
2个回答
展开全部
建议:
将
Dim n1 As Integer, n2 As Integer
改为
Dim n1 As Long, n2 As Integer
应该就可以了。
当然如果数据还要大的话,可以采取一点小措施:
将
Ut = (W - n1 * 53 / 2) / (Sqr(n1 * n2 * 53 / 12))
改为
Ut = (W - n1 / 2 * 53) / (Sqr(n1 / 12 * n2 * 53))
可以稍微扩大一点范围。
将
Dim n1 As Integer, n2 As Integer
改为
Dim n1 As Long, n2 As Integer
应该就可以了。
当然如果数据还要大的话,可以采取一点小措施:
将
Ut = (W - n1 * 53 / 2) / (Sqr(n1 * n2 * 53 / 12))
改为
Ut = (W - n1 / 2 * 53) / (Sqr(n1 / 12 * n2 * 53))
可以稍微扩大一点范围。
追问
不是你说的那样的····
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询