skip to next in loop

Author Message
darkmunk

  • Total Posts : 4
  • Scores: 0
  • Reward points : 0
  • Joined: 1/16/2007
  • Status: offline
skip to next in loop Wednesday, May 09, 2007 10:51 PM (permalink)
0
I have a loop which successfully populates a drop down with filenames but if the filename ends in 'LCK' I would like the loop to miss out that name. I have tried all sorts but nothing works properly. any ideas, thanks.
My code:
[code]
select name="event" id="event">
<option value="">Please select... </option>
<%
set fso=Server.CreateObject("Scripting.FileSystemObject")
myPath = Server.MapPath("/races/")
set fObj=fso.GetFolder(myPath)
for each x in fObj.files
  'if Right(x.name,3) = "LCK" then ---- miss out this filename and move to the next ----
 
   fileNameX = x.Name 
   baseName = fso.GetBaseName(myPath &"\"& fileNameX)
   trimBaseName =(Mid(baseName,3))
 
  %>
<option value="<%=trimBaseName%>"><%=trimBaseName%></option>
<%
next
set fo=nothing
set fs=nothing
%>
</select>[/CODE]
 
#1
    darkmunk

    • Total Posts : 4
    • Scores: 0
    • Reward points : 0
    • Joined: 1/16/2007
    • Status: offline
    RE: skip to next in loop Wednesday, May 09, 2007 11:41 PM (permalink)
    0
    Fixed ...
     
     <select name="event" id="event">
     <option value="">Please select... </option>
     <%
     set fso=Server.CreateObject("Scripting.FileSystemObject")
     myPath = Server.MapPath("/races/")
     
     set fObj=fso.GetFolder(myPath)
     for each x in fObj.files
       if Right(x.name,3) <> "LCK" then 
        fileNameX = x.Name  
       baseName = fso.GetBaseName(myPath &"\"& fileNameX)
       trimBaseName =(Mid(baseName,3))
     %>
     <option value="<%=trimBaseName%>"><%=trimBaseName%></option>
     <%
     end if
     next
     
     set fso=nothing
     %>
     </select>
     

     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9