By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,414 Members | 1,024 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,414 IT Pros & Developers. It's quick & easy.

help with making a command button display an image in an image box

P: 40
Like the title said i need help making a command button display an image in an image box. i have tried the following:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. LoadPicture(["C:\Documents and Settings\robert.lacour.RBG0\Desktop\dans vb stuff\pic\warrior.jpg"])
  3. end sub
it gives me a error that says external name not defined
i have tried just putting the image name there and it also didn't work
please help
Feb 11 '07 #1
Share this Question
Share on Google+
3 Replies


P: 4
Hello!

Create the form and insert 1 Button and 1 Picture Box. Insert this code:

Expand|Select|Wrap|Line Numbers
  1.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.  
  3.         PictureBox1.Image = System.Drawing.Image.FromFile("C:\Documents and Settings\robert.lacour.RBG0\Desktop\dans vb stuff\pic\warrior.jpg")
  4.  
  5.     End Sub 

SKYNETPLUS
Feb 11 '07 #2

P: 40
it highlights the word handles ang gives me an error message that says expected end of statement. help please
Feb 11 '07 #3

balid
P: 18
it highlights the word handles ang gives me an error message that says expected end of statement. help please

The previous example looks like .NET, try something like this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.    PictureBox1.Image = System.Drawing.Image.FromFile("C:\Documents and Settings\robert.lacour.RBG0\Desktop\dans vb stuff\pic\warrior.jpg")
  3. End Sub
  4.  
Feb 12 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.