PDA

Click to See Complete Forum and Search --> : Error in dynamic arrya


eng70640
Feb 20th, 2001, 09:56 AM
Public iCount as intger .
Why is it there is error in this statement - ReDim Preserve lHwnd(iCount) ?

groovydaz
Feb 22nd, 2001, 12:19 PM
Public iCount as intger .
ReDim Preserve lHwnd(iCount)

Firstly assuming intger isn't your own data-type it is spelt wrong, maybe thats just a typo when you typed your code in here, but if its in the original it may be a problem. What Error do you get:

If its array already dimensioned, check the original Declare of the array it should have empty brackets:

Public lHwnd() As Long 'For Example

If its subscript out of range, put a breakpoint on the line:
ReDim Preserve lHwnd(iCount)
and check the value of Icount if its negative then thats the problem.

You need to supply a bit more information though for people to tell what the problem is.