How to Create a Picture Box in Visual Basic

By eHow Internet Editor

Rate: (3 Ratings)

Visual Basic forms, in addition to holding and eliciting textual data from the user, can also display graphic images. Picture boxes can display a variety of image file types, including gif, jpg, ico, bmp and wmf. A picture box can also be linked to a field in a database. Picture boxes differ from image boxes in that they consume more memory, but they are more flexible and offer more properties for modification. For example, picture boxes can be used as containers to hold other controls, not just images.

Instructions

Difficulty: Easy

Create the Picture Box

Step1
Access the tools in the "Toolbox" palette. Double-click the "PictureBox" tool once you've found it to create your picture box.
Step2
Scroll through the properties window until you reach the "Picture" property. The properties window has two columns, one for the name of each property, and one for the value that the property is set to. In the column next to "Picture," you'll see a small button with three dots. Click this button to get a dialog box and choose a graphic image file to assign to the recently created picture box.
Step3
Scroll through the properties window until you reach the "Autosize" property. Click in the column next to "Autosize," and set it to "True" if you want your image to change size when you change the picture box's size. Set it to "False" otherwise.

Name the Picture Box

Step1
Select the picture box by clicking on the box until the resizing handles show up. Scroll through the properties window until you reach the "Name" property. Click in the column next to "Name," and type in any the word want to use to name your picture box.
Step2
Choose a conventional name so your code is easy to decipher. Picture box should begin with "pic" and then a capitalized short word that describes the picture box's contents. If the picture box will be linked to a database, consider naming it "pic" plus the name of the field it's to be linked to.

Tips & Warnings

  • Be aware that when a picture box is assigned a graphic file, it automatically clips the image to conform to its boundaries.
  • Realize that shrinking or stretching the picture box control after you create it won't alter the size of the image displayed unless you first set the "Autosize" property of the control to "True."

Post a Comment

POST A COMMENT

Request a New How-To Article

Looking for more How To information? Chances are there’s an eHow member who knows how to do what you’re looking to do. Submit an article request now!

eHow Article:  How to Create a Picture Box in Visual Basic

eHow Internet Editor

eHow Internet Editor

Category: Internet

Articles: See my other articles

Related Ads

Internet

Veesites
Meet Virginia DeBolt eHow’s Internet Expert.