How to Save and Retrieve Image in Visual Basic

On a past few days, I’m working on Visual Basic Project on a friend of mine and one of the functionality is that the users are able to add and update their profile picture, on a first glance I didn’t even think that I can do this in VB but after few minutes of digging I found myself doing this is very simple and I want to share how easy this snippet to you.

The aim of the project is to be able the users to add, edit and update user profile with their favorite avatar, like what we have in most social sites now.

Step 1:

Add CommonDialog Components and into the form add and rename the name of the following tools

  • CommonDialog = commondialog
  • Image = imgProfile
  • Command Button = cmdSelectFile
  • Text Box = txtimgPath
  • Command Button = cmdUpload

Step 2:

Okay lets add our code, double click on cmdUpload button to view code window and add this code.

So, now as expected when you click on Select File Button it will pop up another window to select which image you want to upload.

Step 3:

Now it’s time to retrieve our uploaded image, to do that just simply copy this code below.

You can now create user profile with Avatar as easy as that, share your idea below, actually there are still lots of way to upload images but I found this one a very handy to use.

Happy coding ^_^

by Ryan Sutana

  • I’ve practice a number of your website articles with your internet site given that last night, and i also appreciate your path associated with blogging. We tag them to help my personal favorites web page number and will also be reviewing back before long. Take a look at my personal website furthermore along with tell me a person’s believed.

  • Yes, thats specifically what I wanted to hear! Wonderful stuff here. The details and the detail had been just excellent. I think that your perspective is deep, its just nicely thought out and really amazing to see somebody who knows the way to put these thoughts down so properly. Wonderful job on this.