Click here to Skip to main content
15,904,023 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi i need a help. i have to do a project in vb 2005. i just want to create a form which contains button and picture box. when i click on the button it needs to display the openfiledialog and the selected image should upload into the picture box. I have tried to find the soluion but however i couldn't find any related answer. if anyone knows pls help me. thanx in advance.

Maya
Posted
Updated 27-Dec-13 5:54am
v2

It is unlikely that you will find an exact example of what you need.

What your goal should be is to break down each requirement piece by piece and look for examples of how to do each one. Once you have those, you can combine them to make your application complete.

So your first part would be to start with a form.

Then add a button to your form.

Then add a picture box to your form.

Access the button click event in the code-behind and then research how to open an openfiledialog control in a button click event.

Now search how to add a picture from an opendialog to a picturebox.
 
Share this answer
 
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

But, this is a really, really simple task: at it's simplest it's only three lines of code!
1) Create a new OpenFileDialog
2) Use it's ShowDialog method to prompt the user to find the file.
3) Set the PictureBox.Image property to the output of the Image.FromFile method, passing that the FileName property from the OpenFile Dialog.
 
Share this answer
 
Do you have any idea what engineering is? This is not "finding", this is doing your job. If everyone would only try to "find any related answer", who would write some code? You need to write code, instead of searching for anything.

So, here is the exact instructions for you: get some time, sit down, and write down the code according to the requirements you just described. There is no "expert knowledge" you might need; everything is written is standard MSDN documentation.

This is just a tiny piece of work. If you are not capable of doing this piece, no "answer" will ever help you, because it would make you seeking for another answer for another tiny piece of work, blocking you from doing any work at all.

—SA
 
Share this answer
 
v2

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