-
Sep 8th, 2004, 05:39 PM
#1
Thread Starter
New Member
Subscript out of range Run time error 9
Hi,
I am getting this error( Runtime Error 9 Subscript out of range) when i try to click on the button, I am using VB6.0 with SQL Server2000. I am giving the code over here, can any body help me to get out of this.. appreciate your help
Thanks
Public Sub cmdLvl2Click(ByVal aIndex As Integer, ByVal aiButton As Integer)
‘If the time Interval of the tmrCreateProcess
'timer is set that means the task is in the que and that the finction is
'called successively.
If frmmain.tmrCreateProcess.Interval Then Exit Sub
If aiButton = 2 And objNav.OperationMode = gctEditor Then
'condition added by RL for #10320
'If aIndex < objNav.TaskButtons.Count Then
objNav.CurrentButtonId = objNav.TaskButtons.Item(aIndex + 1).ButtonID
Set cobjFrmTaskOp = New cTaskOpDisplay
cobjFrmTaskOp.Parent = Parent
cobjFrmTaskOp.EditTaskop
If Not (cobjFrmTaskOp Is Nothing) Then
Set cobjFrmTaskOp = Nothing
End If
Call RefreshButtons
'End If
Else
If aiButton = 1 And objNav.OperationMode = gctNavigator And _
objNav.TaskButtons.Item(aIndex).TaskId <> 0 Then
'set the global g_objmaindisplay object,
'The object is used by the tmrCreateProcess control to execute the clicked
'task.
Set g_objmaindisplay = Me
g_index = aIndex
frmmain.tmrCreateProcess.Interval = 100
'ExecuteBtnTask (aIndex)
' the above code commented ,since the same is being
'done by the tmrCreateProcess control
End If
End If
Screen.MousePointer = vbNormal
End Sub
I am getting the error here:
If aiButton = 1 And objNav.OperationMode = gctNavigator And _
objNav.TaskButtons.Item(aIndex).TaskId <> 0
-
Sep 8th, 2004, 05:50 PM
#2
Can you please use the code tags...it is sooo hard to read the code like it is now..
-
Sep 8th, 2004, 05:54 PM
#3
"Subscript out of range" means that you are trying to access part of an array that doesnt exist. (like if there are 10 items, you are trying to get the 20th item out of it)
I'm tired (off to bed soon) so I havent read all of your code. I'd guess it is this though:
objNav.TaskButtons.Item(aIndex).TaskId
Check the value of aIndex - it is probably outside the limits of the array (nb: the first iteim in an array is usually 0, not 1 as you might expect).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|