|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Dir Function just stopped working!Following is a simple version of my now non-working code: hihi = Dir("c:\burn2\*.*", FileAttribute.Normal) Do While Len(hihi) > 0 hoho = hehe hihi = Dir() Loop All I am looking to do is perform certain functions on each file in a directory ("burn2"). This has been working for months. Today I made some unrelated changes to the the program, and now, when I try to run the program, the Dir function only works the first time. When it trys to access the 2nd file, it doesn't find anything, and so goes out of the loop. I tried taking the changes out. I've tried sticking the exact code you see above into my program just to see the dir() function work properly. It doesn't. I've tried creating a new solution and project with JUST THE ABOVE CODE, nothing more. Dir() still only works the first time. Closing out vb.net and rebooting my computer doesn't help either. At this point, either I am missing something simple, or I feel I need to reinstall vb.net. Any ideas? Thank you in advance for any help! Mike Cooper <bida***@yahoo.com> schrieb
Show quoteHide quote > Hi, No solution, but why not use the System.IO classes? Even if you wanna stay > > Following is a simple version of my now non-working code: > > hihi = Dir("c:\burn2\*.*", FileAttribute.Normal) > Do While Len(hihi) > 0 > hoho = hehe > hihi = Dir() > Loop > > All I am looking to do is perform certain functions on each file in > a directory ("burn2"). This has been working for months. Today I > made some unrelated changes to the the program, and now, when I try > to run the program, the Dir function only works the first time. > When it trys to access the 2nd file, it doesn't find anything, and > so goes out of the loop. > > I tried taking the changes out. I've tried sticking the exact code > you see above into my program just to see the dir() function work > properly. It doesn't. I've tried creating a new solution and > project with JUST THE ABOVE CODE, nothing more. Dir() still only > works the first time. > > Closing out vb.net and rebooting my computer doesn't help either. At > this point, either I am missing something simple, or I feel I need > to reinstall vb.net. Any ideas? > > Thank you in advance for any help! > Mike Cooper > with Dir(), try it this time with dim files as string() fils = System.IO.Directory.GetFiles("c:\burn2", "*,*") What does files contain afterwards? Armin <bida***@yahoo.com> schrieb:
> hihi = Dir("c:\burn2\*.*", FileAttribute.Normal) I suggest not to use 'Dir' for file enumeration because it is not > Do While Len(hihi) > 0 > hoho = hehe > hihi = Dir() > Loop > > All I am looking to do is perform certain functions on each file in a > directory ("burn2"). This has been working for months. Today I made > some unrelated changes to the the program, and now, when I try to run > the program, the Dir function only works the first time. When it trys > to access the 2nd file, it doesn't find anything, and so goes out of > the loop. re-entrant. You can use 'System.IO.Directory.GetFiles' instead: \\\ Imports System.IO .. .. .. For Each FileName As String In Directory.GetFiles("C:\foo", "*.*") ... Next FileName /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
"Selecting" from a data table
Strangest damn error - database at fault? CRC checksum algorithm 2 different numbers..... Array of Value/Ref type Closing event Finding a webservice server persistent data source (light footprint, secure, supports sql query engine) weird problem with XMLSerializer OpenFileDialog |
|||||||||||||||||||||||