Results 1 to 4 of 4

Thread: Quickie little question... my brain's dead.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Cleveland, Ohio
    Posts
    263
    I declared:
    Public HList(0) As MyType

    and then used:

    Redim Preserve HList(Ubound(HList) + 1) As MyType

    and I get the error "already dimensioned". Someone help?

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    That is because you have declared the array as a fixed size array. You need a dynamic one.

    Code:
    Public HList() As MyType
    Iain, thats with an i by the way!

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Cleveland, Ohio
    Posts
    263
    I did this, no error occurs, but Ubound(HList) returns error "subscript out of range", and no data has been stored as it should have.

  4. #4
    Guest
    its because it has no data

    Code:
    Dim Counting As Long
    Dim HList() As String
    Private Sub Form_Load()
        Counting = 0
    End Sub
    
    Private Sub Command1_Click()
        ReDim Preserve HList(Counting)
        HList(Counting) = "Hello" & Counting
        MsgBox HList(Counting)
        Counting = Counting + 1
    End Sub

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