By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,234 Members | 1,869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,234 IT Pros & Developers. It's quick & easy.

Exiting a nested loop

P: n/a
Hi all,

It may be that I am getting this wrong or doing it the wrong way but
this has been stuck.

I have a loop inside a loop, based on a certain condition i want to
cause the primary loop "to loop". If that makes sense! see the pseudo
code below:
For Each MyFile in Files

For Each FileExtension In ArrayList
If Path.GetExtension(FileExtension)="doc" Then
Exit This For Eacg
Move To Next MyFile
Next

Next
So, basically, if the file extension is equal to one of the values in my
list then I just want to ignore and grab the next file to process.

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a


For Each MyFile As String In MyFiles

' If the extension is in the list, then we found one...

If ExtensionList.Contains ( Path.GetExtension ( MyFile ) ) Then

' Exit For?

End If

' Not in the list, so continue.....

Next

"Daniel" <da****@madridmadridsoleado.com> wrote in message
news:u3*************@TK2MSFTNGP10.phx.gbl...
Hi all,

It may be that I am getting this wrong or doing it the wrong way but this
has been stuck.

I have a loop inside a loop, based on a certain condition i want to cause
the primary loop "to loop". If that makes sense! see the pseudo code
below:
For Each MyFile in Files

For Each FileExtension In ArrayList
If Path.GetExtension(FileExtension)="doc" Then
Exit This For Eacg
Move To Next MyFile
Next

Next
So, basically, if the file extension is equal to one of the values in my
list then I just want to ignore and grab the next file to process.

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.

Nov 21 '05 #2

P: n/a
Daniel,

Exit For

Kerry Moorman
"Daniel" wrote:
Hi all,

It may be that I am getting this wrong or doing it the wrong way but
this has been stuck.

I have a loop inside a loop, based on a certain condition i want to
cause the primary loop "to loop". If that makes sense! see the pseudo
code below:
For Each MyFile in Files

For Each FileExtension In ArrayList
If Path.GetExtension(FileExtension)="doc" Then
Exit This For Eacg
Move To Next MyFile
Next

Next
So, basically, if the file extension is equal to one of the values in my
list then I just want to ignore and grab the next file to process.

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.

Nov 21 '05 #3

P: n/a
Robin Tucker wrote:
For Each MyFile As String In MyFiles

' If the extension is in the list, then we found one...

If ExtensionList.Contains ( Path.GetExtension ( MyFile ) ) Then

' Exit For?

End If

' Not in the list, so continue.....

Next

"Daniel" <da****@madridmadridsoleado.com> wrote in message
news:u3*************@TK2MSFTNGP10.phx.gbl...
Hi all,

It may be that I am getting this wrong or doing it the wrong way but this
has been stuck.

I have a loop inside a loop, based on a certain condition i want to cause
the primary loop "to loop". If that makes sense! see the pseudo code
below:
For Each MyFile in Files

For Each FileExtension In ArrayList
If Path.GetExtension(FileExtension)="doc" Then
Exit This For Eacg
Move To Next MyFile
Next

Next
So, basically, if the file extension is equal to one of the values in my
list then I just want to ignore and grab the next file to process.

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.



Works perfect, thanks.

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.