Results 1 to 5 of 5

Thread: finishing touches

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    finishing touches

    Ok, I'm looping through a Filelistbox doing stuff. Everytime I loop through, I want my label to display the index of the file it's on. This doesn't seem to work:
    VB Code:
    1. lblcurrent.caption = File1.ListIndex

    It always returns a -1

  2. #2
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375

    Re: finishing touches

    Originally posted by hipopony66
    Ok, I'm looping through a Filelistbox doing stuff. Everytime I loop through, I want my label to display the index of the file it's on. This doesn't seem to work:
    VB Code:
    1. lblcurrent.caption = File1.ListIndex

    It always returns a -1
    ListIndex shows which one is clicked. If your just looping, then do something like:


    VB Code:
    1. For i = 1 To File1.ListCount
    2.     'do whatever here
    3.     Label1 = File1.List(i)
    4.     'do whatever here
    5. Next
    You just proved that sig advertisements work.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    no...

    That gives the listitem not the index value

  4. #4
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    For i = 0 to File1.Listcount-1
    Label1=i
    next

    i will always = the index of the listbox.
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  5. #5
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    You'll have to add a DoEvents or lbl.Refresh statement in the loop or you'll never see the update in the label.

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