Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2007

Tip: Looking for answers? Try searching our database.

Next File (System.IO)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ElmoWatson - 16 Feb 2007 16:33 GMT
Let's say I have a file loaded, whether it be text or picture.

I want to be able to have a 'Next' button, which loads the next file in the
current directory.

I can load the files just fine, and to some extent, I understand System.IO
(deleting/path designations, etc), but how can I look at the path of that
first file, which is loaded, and load the next one in the path?
Kevin Spencer - 16 Feb 2007 19:12 GMT
The System.IO.Directory.GetFiles() method will return an array of the file
paths of all the files in the directory. You can work off of that.

Signature

HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

I had the same problem once. Fixed it using the same solution.

> Let's say I have a file loaded, whether it be text or picture.
>
[quoted text clipped - 5 lines]
> (deleting/path designations, etc), but how can I look at the path of that
> first file, which is loaded, and load the next one in the path?
Elmo Watson - 18 Feb 2007 02:40 GMT
Can you point me to a website that shows how to do this?
I'm kind of lost on how to do it still.....

> The System.IO.Directory.GetFiles() method will return an array of the file
> paths of all the files in the directory. You can work off of that.
[quoted text clipped - 9 lines]
>> (deleting/path designations, etc), but how can I look at the path of that
>> first file, which is loaded, and load the next one in the path?
Markus - 18 Feb 2007 08:35 GMT
>> The System.IO.Directory.GetFiles() method will return an array of
>> the file paths of all the files in the directory. You can work off
>> of that.
>
> Can you point me to a website that shows how to do this? I'm kind of
> lost on how to do it still.....

first get all files, maybe in some init-code:
string[] files = System.IO.Directory.GetFiles();
int currentFile = 0;

then use this list to loop over this:

void OnButtonNextClick(...)
{
  currentFile++;
  string newFile = files[currentFile];
  // do whatever you need with the new file
}

hope this helps
Markus
RobinS - 18 Feb 2007 18:12 GMT
Did you try googling it yourself? Or go search msdn2.com for
system.io.directory.getfiles() ?

Robin S.
--------------------------------------
> Can you point me to a website that shows how to do this?
> I'm kind of lost on how to do it still.....
[quoted text clipped - 13 lines]
>>> that
>>> first file, which is loaded, and load the next one in the path?
Kevin Spencer - 19 Feb 2007 12:30 GMT
Here's the MSDN reference on the  System.IO.Directory class. It contains a
number of examples:

http://msdn2.microsoft.com/en-us/library/system.io.directory.aspx

Signature

HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

I had the same problem once. Fixed it using the same solution.

> Can you point me to a website that shows how to do this?
> I'm kind of lost on how to do it still.....
[quoted text clipped - 13 lines]
>>> that
>>> first file, which is loaded, and load the next one in the path?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.