views:

198

answers:

3

how can i display the image beside the button in visual basic express 2008??

A: 

You have to edit the Image property of the button. (Go to the tab "properties")

Amokrane
A: 

Set the button's Image property.

Here I have an Image called FAIntHead. I included it in the project using Project->Properties and selected the Resources tab There you select Add Resource and select Add Existing File

button1.Image = Properties.Resources.FAIntHead;
Nifle
What about the `My` namespace?
Cyclone
A: 

If you mean you just want a nice picture, that does not change, displayed beside a button:

Add a button and picture box from the toolbox, under common Controls, and place them wherever you want them on your Form1.vb [Design] tab. Click the Picture box and select Properties Window from the command bar at the top of the screen listed under View. From the Properties window that appears, Scroll down to “Image”, under Appearance and click on it once to highlight it. When you click on Image, you should see an ellipsis button appear beside it […] In the pop-up that follows, select the “Project resource file” radio button and click import. Once you have selected the image that you want, click the OK button to add the image to the picture box on your form.

If your intent is to have a button that selects an image to display:

Add a button and picture box from the toolbox, under common Controls, and place them wherever you want them on your Form1.vb [Design] tab. Next, add an “OpenFileDialog”, found under Dialogs, from your toolbox to the form. Now, Double click the button you added to your form and enter the following code:

OpenFileDialog1.ShowDialog()

Next, Go back to the Design tab and double click OpenFileDialog1 and enter the following code:

path = New Bitmap(OpenFileDialog1.FileName)
PictureBox1.Image = path

Stay in the same tab you just entered the above code, place your cursor on line 2, and enter the following code:

Private path As Bitmap

Finally, go to the form design tab and physically adjust your picture box as large as you want it. Now, click once on the picture box. Go to the properties window and change the Size Mode to Zoom. Start Debugging..

If this is not what your looking for then please be more specific in what your looking for. What are you looking for as an end result?

TSSH
Could also add an OpenFileDialog using code, I find it easier personally.
Cyclone
Well yea, Suuure. If you want to do it the eeeasy way. But I'm supposed to walk up hill against the snow for weeks on end, before I notice the bus route that runs every 10 min., parallel to my nicely compacted trail. lol, Thanks Cyclone.
TSSH