内存溢出
本帖最后由 pc528 于 2012-12-06 16:59:36 编辑 在窗口添加下面代码
'齿轮1-3齿向载荷分布系数
Dim K1(12, 22, 42, 52, 62, 72) As Single
If cbogear12.Text = "5级" Then
K1(12) = 6.7
ElseIf cbogear12.Text = "6级" Then
K1(12) = 13.3
ElseIf cbogear12.Text = "7级" Then
K1(12) = 23.9
ElseIf cbogear12.Text = "8级" Then
K1(12) = 34.8
ElseIf cbogear12.Text = "9级" Then
K1(12) = 47
End If
'齿轮2齿向载荷分布系数
If cbogear22.Text = "5级" Then
K1(22) = 6.7
ElseIf cbogear22.Text = "6级" Then
K1(22) = 13.3
ElseIf cbogear22.Text = "7级" Then
K1(22) = 23.9
ElseIf cbogear22.Text = "8级" Then
K1(22) = 34.8
ElseIf cbogear22.Text = "9级" Then
K1(22) = 47
End If
'齿轮4齿向载荷分布系数
If cbogear42.Text = "5级" Then
K1(42) = 6.7
ElseIf cbogear42.Text = "6级" Then
K1(42) = 13.3
ElseIf cbogear42.Text = "7级" Then
K1(42) = 23.9
ElseIf cbogear42.Text = "8级" Then
K1(42) = 34.8
ElseIf cbogear42.Text = "9级" Then
K1(42) = 47
End If
'齿轮5齿向载荷分布系数
If cbogear52.Text = "5级" Then
K1(52) = 6.7
ElseIf cbogear52.Text = "6级" Then
K1(52) = 13.3
ElseIf cbogear52.Text = "7级" Then
K1(52) = 23.9
ElseIf cbogear52.Text = "8级" Then
K1(52) = 34.8
ElseIf cbogear52.Text = "9级" Then
K1(52) = 47
End If
'齿轮6-8齿向载荷分布系数
If cbogear62.Text = "5级" Then
K1(62) = 6.7
ElseIf cbogear62.Text = "6级" Then
K1(62) = 13.3
ElseIf cbogear62.Text = "7级" Then
K1(62) = 23.9
ElseIf cbogear62.Text = "8级" Then
K1(62) = 34.8
ElseIf cbogear62.Text = "9级" Then
K1(62) = 47
End If
'齿轮7齿向载荷分布系数
If cbogear72.Text = "5级" Then
K1(72) = 6.7
ElseIf cbogear72.Text = "6级" Then
K1(72) = 13.3
ElseIf cbogear72.Text = "7级" Then
K1(72) = 23.9
ElseIf cbogear72.Text = "8级" Then
K1(72) = 34.8
ElseIf cbogear72.Text = "9级" Then
K1(72) = 47
End If
Dim K2 As Single
K2 = 0.0087
在Module模块添加通用变量
'齿轮Ⅱ精度等级声明
Public K1(12, 22, 42, 52, 62, 72) As Single
Public K2 As Single
造成内存溢出,求教高手
[解决办法]
Dim K1(12, 22, 42, 52, 62, 72)
你是想定义K1有6个不同下标是吧,你这么定义,成6维数组了都,能不溢出么
定义成Dim K1(12 To 72)看看。