Click here to Skip to main content
15,895,256 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i use in this code to get all my images from a specific directory,

C#
DirectoryInfo di = new DirectoryInfo("c:/inetpub/wwwroot/demos");
FileInfo[] rgFiles = di.GetFiles("*.GIF");


now i want to see a visual image on the window from the second image taht i got.
i can't to do it by index (rgFiles[1] ) -

becouse the visual 2010 dont recognize it.
thanks!
Posted
Updated 23-Jan-12 3:08am
v3
Comments
lukeer 23-Jan-12 8:52am    
Why can't you do that?
Does the compiler give you an error message?
Do you get an exception at run time?
If there is one or the other, what does it say?

Please use the "Improve question" link to rework your question in greater detail.
nav571 23-Jan-12 9:20am    
pleas answer me!!

It's very necessary!

1 solution

To view the image in your app, you would have to load the file content into an Image based class:

C#
DirectoryInfo di = new DirectoryInfo(@"c:/inetpub/wwwroot/demos");
FileInfo[] rgFiles = di.GetFiles("*.gif");
Image i = Image.FromFile(rgFiles[0].FullName);
You can them display the image via a PictureBox or the Graphics.DrawImage method.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900