How to Create an Image 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. Image boxes can display a variety of image file types, including gif, jpg, ico, bmp and wmf. An image box can also be linked to a field in a database. Image boxes differ from Picture boxes in that they consume less memory, are less flexible and offer fewer properties for modification.

Instructions

Difficulty: Easy

Create the Image Box

Step1
Hover the mouse over each tool in the Toolbox palette until you find the one called "Image" (its name will pop up on the side as a yellow tag). Double-click the "Image" tool once you've found it.
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 that will allow you to choose a graphic image file to insert into your recently created image box.
Step3
Drag the image box from anywhere in its interior to move it to the desired position.

Name the Image Box

Step1
Ensure that the image box is still selected (if the resizing handles aren't showing, click once on the image box), and scroll through the properties window until you reach the "Name" property. Click in the column next to "Name," and type in any single alphanumeric word that you can use to identify the image box in later code.
Step2
Start the name of the image box with "img." Follow this with a capitalized short word that describes the image box's contents. If the image box will be linked to a database, consider naming it "img" plus the name of the field it will be linking to.

Tips & Warnings

  • Be aware that when a graphic file is placed within an image box, the control automatically grows or shrinks to the size of the graphic file placed within it.
  • Realize that shrinking or stretching the image box control after you create it won't alter the size of the image displayed. If you shrink the control too far, you will merely cut off parts of your image.

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 an Image 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.