PDA

Click to See Complete Forum and Search --> : Invalid ReDim - please help!!!


Jhd.Honza
Jan 24th, 2000, 04:48 AM
I have got a big problem now.
In declaration section I have:

Type Foto
Picture() As IPicutreDisp 'or something like that
Descrip() as String
End Type

Some rows of a sub are:

ReDim Foto.Picture(Val(read))
ReDim Foto.Descrip(Val(read))

where the first line (picture) cause a error 'Invalid ReDim'. Where is the error? I need to leave a picture stored in a dynamic array.



------------------
Thanks,
John, 14 years old

ChrisJackson
Jan 24th, 2000, 05:25 AM
Hi John,

What is the value of read when you get this error?

If you want to keep the info. already stored in your array when you Redim it, you must use Redim Preserve rather than Redim alone.

All the best.

Chris

Jhd.Honza
Jan 25th, 2000, 12:42 AM
Thank you for your answer.

The value of read is usually 1 to 3 or 5, no big numbers.
Preserve keyword cause the same error.

What should I do now?

RogerH
Jan 25th, 2000, 01:17 AM
Hi John,

the problem seems to be the type! Try this:


Type Foto
Picture() As IPicutreDisp 'or something like that
Descrip() as String
End Type

sub test
dim testvar as Foto

ReDim testvar.Picture(Val(read))
ReDim testvar.Descrip(Val(read))

end sub


Roger