473,395 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Load a list of images from a directory

Hi, i would like to know the code so when i load a Form it shows me the list of images in a specific folder inside the app folder, but i dont know wich control to use, like imageslist or list view, so when i have in the form the display list of all the images in that folder i can select one and it shows the image in a picture box.

Thank you so much for your help
Mar 14 '14 #1
2 8673
Hello Luistkd

You can use this to get your application location

Expand|Select|Wrap|Line Numbers
  1. Dim directory As String = My.Application.Info.DirectoryPath
  2.  
  3. And Use 
  4.  
  5. Dim di As New IO.DirectoryInfo(directory)
  6. Dim diar1 As IO.FileInfo() = di.GetFiles("*.jpg")
  7. Dim dra As IO.FileInfo
  8.  
  9. For Each dra In diar1
  10. ListBox1.Items.Add(dra)
  11. Next
  12.  
  13. To Get The Pictures In A ListBox 
  14.  
  15. You Can Change This Line If The Pictures Are Not In A .jpg Extension To Any Other Extension
  16.  
  17. Dim diar1 As IO.FileInfo() = di.GetFiles("*.jpg")
  18.  
  19. So This Is The Final Code
  20.  
  21. Dim directory As String = My.Application.Info.DirectoryPath
  22. Dim di As New IO.DirectoryInfo(directory)
  23. Dim diar1 As IO.FileInfo() = di.GetFiles("*.jpg")
  24. Dim dra As IO.FileInfo
  25.  
  26. For Each dra In diar1
  27. ListBox1.Items.Add(dra)
  28. Next
I Hope This Is What You Were Looking For
Mar 16 '14 #2
Frinavale
9,735 Expert Mod 8TB
Would help us to answer this question if you told us what type of project you are developing: WinForms, WPF, ASP.NET...???

Here is an example of how to accomplish this in a WPF application.

-Frinny
Mar 18 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: BrunoSilveira_BR | last post by:
Hi folks, I've tried to use the novell c# ldap library to connect to my unix ldap directory. But everytime i try to debug my application i receive the error message: "unable to load...
3
by: Mary Jane Pronio | last post by:
What I want to do is take that output, use the data within it to put into a shell script as input to another installation of DB2 Connect on another AIX box. Any ideas about how to do this?
3
by: Bernie Yaeger | last post by:
I'm trying to add different images to the nodes and subnodes of a tree list. I would like the primary nodes to display one image and the secondary nodes several different images, and then, of...
4
by: IT | last post by:
At run time I want to alternate the images in a picture box dependant on some code. Add created a folder called graphics in my Project and dragged the images there. Now at run time what is there...
9
by: peter.mosley | last post by:
Hello again I'm still wrestling with Python / Tkinter / PIL. I have almost got it to work - on a Fedora Core 1 system I can now display images in a Tkinter window. But I also run a Fedora Core...
4
by: jordi_ramis | last post by:
Hi, I'm currently using image.fromfile to load jpg images in my application. I've noted that this procedure is very slow compared to some aplications I have seen. Is there any way to load a jpeg...
7
by: petr pilsl | last post by:
sorry - no idea where to post my question, so I crossposted to a linux and a html-authoring-group. Both groups might be familiar with wget. wget -p http://www.goldfisch.at does not load the...
1
by: dcruncher4 | last post by:
DB2 8.2.3 is there a sql equivalent to get the information provided by db2 list node directory db2 list db directory. thanks.
0
by: Anjan Bhowmik | last post by:
Hi, I use a form to upload an image to a directory on my site (~/Images/UserName/file1.jpg). Using Server.mapPath function i get the Physical path and save the file using...
1
by: Jincythomas | last post by:
I want to load multiple images using drop down list it has to be from database.My project is going to have 3 drop down list on the basis of each selection I need to load the images from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.