Results 1 to 4 of 4

Thread: Dimming Error

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026

    Dimming Error

    When I execute the following code:

    Code:
    Dim NumFiles As Integer
    NumFiles = List1.ListCount
    Dim Files(NumFiles) As Integer
    I get:

    Error: Constant Expression Required

    Why???

  2. #2
    jim mcnamara
    Guest
    Dim Files() as Integer
    ...
    Redim Files(NumFiles)

  3. #3
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375
    You can't give variable bounds to a fixed-length array. Use a dynamic array instead:
    VB Code:
    1. Dim NumFiles As Integer
    2. NumFiles = List1.ListCount
    3. Dim Files() As Integer
    4. ReDim Files(NumFiles)
    You just proved that sig advertisements work.

  4. #4
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375
    Dammit! got beat again
    You just proved that sig advertisements work.

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