Results 1 to 4 of 4

Thread: Invalid ReDim - please help!!!

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    Prague, Czech Republic
    Posts
    350

    Post

    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

  2. #2
    Lively Member
    Join Date
    Oct 1999
    Posts
    101

    Post

    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

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    Prague, Czech Republic
    Posts
    350

    Post

    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?

  4. #4
    Lively Member
    Join Date
    Dec 1999
    Location
    Karlsruhe, Germany
    Posts
    122

    Post

    Hi John,

    the problem seems to be the type! Try this:

    Code:
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width