Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
How can I change a FOR EACH loop to a DO WHILE loop?
Old 03-09-2006, 11:26 PM How can I change a FOR EACH loop to a DO WHILE loop?
waller's Avatar
Skilled Talker

Posts: 59
Location: North Borneo.
Trades: 0
How can I change a FOR EACH loop to a DO WHILE loop?
I have this code...

PHP Code:
<%
For 
Each objFile In objFolder.Files                 
     
If IsImgNotRegistered(objFile.Name)= true then%>
       <
tr>
       <
td>
       <%= 
objFile.Name%>
       </
td>
       </
tr>                                                
    <%                
     
End if
Next
%> 

Actually this code is part of a file, used to fetch Image(.jpeg)
file and check wether it is registered or not.
The 'objFile' is the Image file
and objFolder.Files is the Folder.

How can I change it to a DO WHILE loop?

Thanks.
__________________
$id ="waxxer";
$id = str_replace('x', 'l', $id);
echo $id;
echo " and Marj";
waller is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-10-2006, 06:17 AM Re: How can I change a FOR EACH loop to a DO WHILE loop?
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Whty would you want to?

What you'll need to do is set up a counter, set it to 0 before the loop, and increment it by one on each iteration of the loop. You can then use it to refer to elements in your array. The 'do while' clause will be something like 'DO WHILE MyCounter <= objFolder.Files.Count'
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 03-12-2006, 10:27 PM Re: How can I change a FOR EACH loop to a DO WHILE loop?
waller's Avatar
Skilled Talker

Posts: 59
Location: North Borneo.
Trades: 0
How can I arrange object ascending or descending?


PHP Code:
For Each objFile In objFolder.Files
                 response
.write strObjFile 
the strObjFile is an object. its an object of jpeg file in a folder.
__________________
$id ="waxxer";
$id = str_replace('x', 'l', $id);
echo $id;
echo " and Marj";
waller is offline
Reply With Quote
View Public Profile
 
Old 03-13-2006, 03:12 PM Re: How can I change a FOR EACH loop to a DO WHILE loop?
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Minaki's right. You don't want to go to a do while loop if you can avoid it, because they're a lot more likely to turn into endless loops (a for loop still can if you screw up with your loop variable and use it inside of the loop, but that only happens once in a blue moon.)

What exactly are you trying to accomplish with that code? It looks like you're trying to find all of the JPGs in a folder.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Reply     « Reply to How can I change a FOR EACH loop to a DO WHILE loop?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12880 seconds with 12 queries