Foxtable(狐表)用户栏目专家坐堂 → [求助] 简单运算代码出错,急


  共有2320人关注过本帖树形打印复制链接

主题:[求助] 简单运算代码出错,急

帅哥哟,离线,有人找我吗?
15986720145
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:146 积分:1243 威望:0 精华:0 注册:2015/8/7 16:22:00
[求助] 简单运算代码出错,急  发帖心情 Post By: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
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:146 积分:1243 威望:0 精华:0 注册:2015/8/7 16:22:00
  发帖心情 Post By:2015/11/14 22:55:00 [显示全部帖子]

好像是没有给数组定义长度之前给数组赋值,而出现错误,已经解决!!

 回到顶部