?
Solved

How can i loop tru an Array

Posted on 2005-04-26
3
Medium Priority
?
290 Views
Last Modified: 2010-04-23
I have the folowing Code

Dim tmpSelection() As String
Me.openFileDialog1.Multiselect = True
Me.openFileDialog1.ShowDialog()
tmpSelection = Me.openFileDialog1.FileNames

which means tmpSelection holds a list of selected files. How can i loop thru these 1 by one ?
0
Comment
Question by:AlexPonnath
  • 2
3 Comments
 
LVL 13

Expert Comment

by:Corey Scheich
ID: 13866614
Dim i as string

For each i in tmpselection
    msgbox (i)
next
0
 
LVL 13

Assisted Solution

by:Torrwin
Torrwin earned 800 total points
ID: 13866631
Dim ArrayLength, ArrayIndex as Integer

ArrayLength = tmpSelection.Length
ArrayIndex = 0

While ArrayLength > ArrayIndex

'<execute your code>
'For Example:  MessageBox.Show(tmpSelection(ArrayIndex))  where ArrayIndex points to your item

ArrayIndex += 1
End While
0
 
LVL 13

Accepted Solution

by:
Corey Scheich earned 1200 total points
ID: 13866678
Or if you need to keep track of how many you have looped through

Inculde Windows.VisualBasic

Dim i as Long

i = 0
for i = 0 to ubound(tmpselection)
       msgbox(tmpselection(i) & "This is file # " & i.tostring)
next
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question