|
-
Dec 11th, 2005, 02:15 PM
#1
Thread Starter
Addicted Member
What sort of Error is this ?
well here is the part of my code
VB Code:
Private msngMouseX() As Single
Private msngMouseY() As Single
Private Sub xic_MouseMove( _
Index As Integer, _
Button As Integer, _
Shift As Integer, _
x As Single, _
Y As Single _
)
If (Button = vbLeftButton) Then
xic(Index).Move (xic(Index).Left + x - msngMouseX(Index)), _
(xic(Index).Top + Y - msngMouseY(Index))
Else
msngMouseX(Index) = x
msngMouseY(Index) = Y
End If
End Sub
well it runs fine but at run time when i m moving instances of Xic in my workspace here and there .. after some time .. VB prompts as " run time error '9' subscript out of range " ..
and hightlights this line in yellow
msngMouseX(Index) = x
what should i do to get rid of this problem
-
Dec 11th, 2005, 02:26 PM
#2
Re: What sort of Error is this ?
Add a debug.print statement in the left button statement, to get the values of everything. It should be easy to see which numbers are wrong.
-
Dec 11th, 2005, 03:01 PM
#3
Thread Starter
Addicted Member
Re: What sort of Error is this ?
no improvement added "debug.pring" like this
VB Code:
Private Sub xic_MouseMove( _
Index As Integer, _
Button As Integer, _
Shift As Integer, _
x As Single, _
Y As Single _
)
If (Button = vbLeftButton) Then
xic(Index).Move (xic(Index).Left + x - msngMouseX(Index)), _
(xic(Index).Top + Y - msngMouseY(Index))
Debug.Print
Else
msngMouseX(Index) = x
msngMouseY(Index) = Y
End If
End Sub
... same result ... it shows same error and after some ... u r gettin what i m trying to do i m jus dragging instance of Xic inside workspace from here and there .... what should i do
-
Dec 11th, 2005, 03:17 PM
#4
Re: What sort of Error is this ?
No, I meant something like this:
VB Code:
debug.pring xic(Index).Left & " " & x & " " & msngMouseX(Index))
so you could see the values of the variables. What is the last variable?
add another line for the Y variables.
-
Dec 11th, 2005, 04:02 PM
#5
Re: What sort of Error is this ?
or when the program stops click on Debug and then you can print the value of Index in the immediate window.
How have you dimensioned msngMouseX?
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
|