Results 1 to 4 of 4

Thread: [RESOLVED] Need help with Openning JPG

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2005
    Posts
    37

    Resolved [RESOLVED] Need help with Openning JPG

    I have on "open" dialog like this:
    VB Code:
    1. On Error GoTo ErrHandler
    2.    CommonDialog1.Filter = "JPG (*.jpg)|*.jpg"
    3.    CommonDialog1.FilterIndex = 2
    4.    CommonDialog1.ShowOpen
    5.    Exit Sub
    6. ErrHandler:
    7.    Exit Sub
    I am trying to have the the file selected show up in Image1.... Please help. Thanks in advance

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Need help with Openning JPG

    to load it in the picturebox you need to use the LoadPicture function, like

    Picture1.Picture = LoadPicture("C:\somefile.jpg")

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Need help with Openning JPG

    The commondialog only gets the filename for you, to do anything with the file you need to add extra code.

    Luckily there is a simple piece of code to load a picture (called LoadPicture), which can be used like this:
    VB Code:
    1. Set Image1.Picture = LoadPicture(CommonDialog1.FileName)
    This line of code should be placed just after your ".ShowOpen" line.

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 2005
    Posts
    37

    Re: Need help with Openning JPG

    Thanks Si

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width