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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bagstoper
    New Member
    • Feb 2007
    • 40

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

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

    Code:
    Private Sub Command1_Click()
    LoadPicture(["C:\Documents and Settings\robert.lacour.RBG0\Desktop\dans vb stuff\pic\warrior.jpg"])
    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
  • skynetplus
    New Member
    • Feb 2007
    • 4

    #2
    Hello!

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

    Code:
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
            PictureBox1.Image = System.Drawing.Image.FromFile("C:\Documents and Settings\robert.lacour.RBG0\Desktop\dans vb stuff\pic\warrior.jpg")
    
        End Sub

    SKYNETPLUS
    Last edited by skynetplus; Feb 11 '07, 06:17 PM. Reason: Add some Coding

    Comment

    • bagstoper
      New Member
      • Feb 2007
      • 40

      #3
      it highlights the word handles ang gives me an error message that says expected end of statement. help please

      Comment

      • balid
        New Member
        • Feb 2007
        • 18

        #4
        Originally posted by bagstoper
        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:
        Code:
        Private Sub Command1_Click()
           PictureBox1.Image = System.Drawing.Image.FromFile("C:\Documents and Settings\robert.lacour.RBG0\Desktop\dans vb stuff\pic\warrior.jpg")
        End Sub

        Comment

        Working...