Results 1 to 4 of 4

Thread: [RESOLVED] Displaying picture in Image / picture control

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2004
    Posts
    237

    Resolved [RESOLVED] Displaying picture in Image / picture control

    Dear All,
    I have placed an image control on my form. A bitmap picture(picture name is shapes) is placed at my C drive. There is also a command button on the form.

    I want that when I click the button, the picture should be displayed in the image control.

    When I use the following code in the click event of command button it gives me type mismatch error.

    Me.Image1.Picture = "C:\shapes"
    If I try to do so using Picture control, same error comes.

    Plz help and guide.

    Regards,
    software engineer

  2. #2
    Hyperactive Member guyvdn's Avatar
    Join Date
    Oct 2002
    Location
    Belgium
    Posts
    336

    Re: Displaying picture in Image / picture control

    The type mismatch is because "C:\shapes" is a String and vb can't make an image of it. You have to load the picture from the file like this
    VB Code:
    1. Me.Image1.Picture = LoadPicture("C:\shapes.bmp")
    Also make sure you include the extension of the image like bmp or gif or jpg ...
    Last edited by guyvdn; Feb 17th, 2006 at 06:24 PM.
    To deny our own impulses is to deny the very thing that makes us human

  3. #3
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Displaying picture in Image / picture control

    use the LoadPicture function.

    Like,
    VB Code:
    1. Picture1.Picture = LoadPicture("C:\shapes\SomePicture.jpg")
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Sep 2004
    Posts
    237

    Thumbs up Re: Displaying picture in Image / picture control

    Thank you so much to both of you for your help.
    software engineer

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