image question

karim

Member
Joined
Feb 25, 2008
Messages
9
Programming Experience
Beginner
Hello everyone,
I was wondring is it possible to have a folder with pictures in it and create a form that you type the name of one of the pictures in a text box and it show's it on the form.
thanks.
 
great, would you be able to help me or give me some ideas on how to start. that would be really helpfull. thanks
 
This is really a fairly simple project, if you have specific questions as to how to do something I would be more than willing to help, but I won't do your project for you.

You will need a picturebox (obviously), set its sizemode to stretchImage.
You will need a textbox to enter the name of the file to search for.
You will probably need a "Search" button (instead of searching every time the user types in the textbox).
If there is only one specific folder you will be searching in, I would hardcode that in the program. Personally I would allow the user to select the folder.
Finding the correct file is simply looping through all of the files in the folder you/the user specified until you find the correct one.
 
I already had the form set just like how you explained. using loop sounds way better, but I don't even know how to start the code for just a specific folder. but that's how I was planing on doing. just have the program set to one folder that has all the pictures that i want to view. this project is basically for my work. we always scan foam bead pictures, but no one ever looks at it. so i think it's waste of my time to scan them but i have to do it anyway, so i thought if i did a program like that it would make it a little easier for my bosses to take a minute and look at my work, that way at least i would be doing that for a reason.
 
i used to take vb.net in college in 2005. and the version i have is 2003. so it's been a while since i did any programs and i don't remember alot. but any thing that gets me started would be great.
 
Okay. I have a better idea, instead of searching by the file name you could just have a listbox that displays all the names of the files in a certain directory. This would be better IMO because you wouldn't have to know a specific file's name in order to display it. From here you can change the displayed picture depending on the item selected in the list.

To get you started in the right direction:

VB.NET:
Dim files() As String = Directory.GetFiles("C:\", "*.exe")

This will give you an array of filenames that are executables in your C: root.

Edit: You will have to import System.IO for this to work.
 
Back
Top