以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助] 简单运算代码出错,急 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=77274) |
-- 作者:15986720145 -- 发布时间:2015/11/14 22:21:00 -- [求助] 简单运算代码出错,急 以下为某按钮的CLICK事件代码: Dim RedBlueBall() As Integer = { 01,02,07,08,12,13,18,19,23,24,29,30,34,35,40,45,46,03,04,09,10,14,15,20,25,26,31,36,37,41,42,47,48 } Dim BlueGreenBall() As Integer = { 03,04,09,10,14,15,20,25,26,31,36,37,41,42,47,48,05,06,11,16,17,21,22,27,28,32,33,38,39,43,44,49 } Dim RedGreenBall() As Integer = { 01,02,07,08,12,13,18,19,23,24,29,30,34,35,40,45,46,05,06,11,16,17,21,22,27,28,32,33,38,39,43,44,49 } Dim BallColor As String = e.Form.Controls("ComboBox1").Value Dim HeadNum() As String = e.Form.Controls("TextBox2").Text.Split(".") Dim head1 As Integer = CInt(HeadNum(0)) Dim head2 As Integer = CInt(HeadNum(1)) Dim head3 As Integer = CInt(HeadNum(2)) Dim FilterResult() As Integer Dim i As Integer = 0 Dim j As Integer = 0 \'以上代码执行没有出错 For i = 0 To RedBlueBall.length-1 If RedBlueBall(i) >= (head1* 10) And RedBlueBall(i)< (( head1+1)*10) FilterResult(j) = RedBlueBall(i) \'程序进入此行出错----“未将对象引用设置到对象的实例。” j = j+1 Else If RedBlueBall(i) >= (head2*10) And RedBlueBall(i)< ((head2+1)*10) FilterResult(j) = RedBlueBall(i) j = j+1 Else If RedBlueBall(i) >= (head3*10) And RedBlueBall(i)< ((head3+1)*10) FilterResult(j) = RedBlueBall(i) j = j+1 End If Next =================求指点=
[此贴子已经被作者于2015/11/14 22:42:58编辑过]
|
-- 作者:15986720145 -- 发布时间:2015/11/14 22:55:00 -- 好像是没有给数组定义长度之前给数组赋值,而出现错误,已经解决!! |
-- 作者:大红袍 -- 发布时间:2015/11/15 10:42:00 -- Dim FilterResult(RedBlueBall.length-1) As Integer |