Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

For each item in list1, would like to Msgbox ("Each Item in list") 2

Status
Not open for further replies.

mark01

Technical User
Jan 17, 2001
600
0
0
US
I have a listbox, and would like to know the easiest way to do the following:

list1 contains the following:
One
Two
Three
....Fifty


I want to do this:
MsgBox list1.List(0)
MsgBox list1.List(1)
etc..

But I don't want to write this out 50 times. What is the easiest way to do this??

Thanks
 
I suppose you need something alon the lines of the following:

Code:
dim lTeller as integer

for lTeller = 1 to list1.listcount
  MsgBox list1.List(lTeller)
next lTeller

There's no place like 127.0.0.1
 
Dim i as Integer

For i = 0 To List1.ListCount -1
Msgbox List1.List(i)
Next
 
Just thought I would put in my two cents
Go with

bmdb (IS/IT--Manageme) May 14, 2004
Dim i as Integer

For i = 0 To List1.ListCount -1
Msgbox List1.List(i)
Next

My opinion is that "bmdb (IS/IT--Manageme)" deserves a star

But hey thats my opinion




%, 2004
 
I admit that I was mistake with the index-numbering (which I found to be far from consequent in VB6).

For the rest, the code is exactly the same as mine.

Being a grateful person I am awarding a star to bmdb for correcting the code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top