The "PictureBox" control within the Visual Basic computer programming language allows you to insert images into your software application as you build it. Both the Microsoft Visual Basic Express and the Microsoft Visual Studio.NET developer environments come with preinstalled controls, like the "PictureBox" control that you can use to create robust and diverse software applications. The Microsoft Visual Basic Express package is a free download available from Microsoft.com and a direct link can be found in the reference section of this article.
- Skill level:
- Moderately Challenging
Other People Are Reading
Things you need
- Visual Basic Express installed on a PC
- Visual Studio.NET installed on a PC (optional)
Open either Visual Basic Express or Visual Studio.NET depending on which developer environment you have.
Open the project you're working with or create a new one. To create a new one, click on "Create" next to the word "Project" in the upper left-hand corner of the screen. A new window pops up where you choose the type of project. Click on the "Windows Form Application," as this will be the easiest for this example, although the control works just fine in any of the other project types. Type a name for your project in the "File Name" box below and hit "OK" when you're finished. A blank form appears.
Locate the word "View" along the top menu choices and click on "Tool Box" if your toolbox is not visible.
Scroll down the toolbox and locate the "PictureBox" control. Click and drag it to the blank form. Let go of the mouse when you've positioned the "PictureBox" control where you want the picture to be on the form.
Click once on the "PictureBox" control within the form. Navigate to the right-hand side of the screen and choose the "Properties" tab. If it is not visible, click on "View" and then "Properties."
Scroll through the "Properties" tab until you find "Image." The default setting will say "none" next to it with a square with a "..." in it. Click on the three dots. A window will open, allowing you to insert your chosen image into the picture box.
Choose "Local Resource." Click on "Import." A window will open where you can navigate to the location of the picture you want to insert into the "PictureBox" control. Navigate to the location of the picture. Click on the picture file and press the "OK" button.
Either resize the "PictureBox" control box itself to see the entire picture on the form, or readjust the size by typing in smaller numbers in the "Size" settings of the "Properties" tab.
Tips and warnings
- Clicking on the small arrow pointing to the right, found on the "PictureBox" control itself, allows you to choose the type of style of the image, to keep it "Normal," "Centered" or "Stretched." You can change the picture anytime by clicking on the "Properties" tab and changing the "Image" settings again.
- If resizing the "PictureBox" border does not solve the problem of viewing the picture properly or if you are restricted to a certain size of "PictureBox" size and the picture does not fit, you will need to resize the picture file itself and then reattach the picture to the "PictureBox" control.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for