|
-
Apr 24th, 2002, 11:24 PM
#1
Thread Starter
Fanatic Member
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:
lblcurrent.caption = File1.ListIndex
It always returns a -1
-
Apr 24th, 2002, 11:29 PM
#2
Frenzied Member
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:
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:
For i = 1 To File1.ListCount
'do whatever here
Label1 = File1.List(i)
'do whatever here
Next
You just proved that sig advertisements work.
-
Apr 24th, 2002, 11:31 PM
#3
Thread Starter
Fanatic Member
no...
That gives the listitem not the index value
-
Apr 24th, 2002, 11:42 PM
#4
PowerPoster
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.

-
Apr 24th, 2002, 11:42 PM
#5
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|