Results 1 to 6 of 6

Thread: [RESOLVED] Expected Array Error

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Resolved [RESOLVED] Expected Array Error

    I am getting the total of a column in listview and then adding that total to a label. I then want to format it in the format of ##:## and I am getting a "Expected Array" Error. This is my code. Please advise. The error happens on the highlighted part of the code.
    VB Code:
    1. Private Sub Form_Load()
    2.     'declare some variables
    3.     Dim lngIndex As Long, lngTotal As Long
    4.    
    5.     'apply the page color scheme to the form
    6.     PageColorScheme Me
    7.    
    8.     'center the form
    9.     CenterForm Me
    10.    
    11.     'keep the form from going behind any others
    12.     KeepScreenOnTop = SetWindowLong(Me.hwnd, GWL_HWNDPARENT, frmControlPanel.hwnd)
    13.    
    14.     'populate some labels
    15.     'add the date to this label
    16.     lblDate(1).Caption = Date
    17.        
    18.     'add everything within subitems(8) and get
    19.     'a total and display that total in the
    20.     'lblTime label
    21.     For lngIndex = 1 To lvwTimeLog.ListItems.Count
    22.         lngTotal = lngTotal + lvwTimeLog(lngIndex).SubItems(8)
    23.     Next
    24.    
    25.     [hl]lblTime(1).Caption = Format(lngTotal(Time, "HH:NN"))[/hl]
    26. End Sub

  2. #2

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Expected Array Error

    Quote Originally Posted by MartinLiss
    Do you have a control array called lbltime on that form?
    lblTime(0) and lblTime(1)
    lblTime(0) is the a header for the other label.

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Expected Array Error

    Code:
    lblTime(1).Caption = Format(lngTotal(Time), "HH:NN")
    perhaps?

  5. #5

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Expected Array Error

    Quote Originally Posted by MartinLiss
    lblTime(1).Caption = Format(lngTotal, "HH:NN")
    thanks Mr. Liss. Tried everything but that
    ::kicks self in butt::

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