Results 1 to 3 of 3

Thread: Find file type from picturebox

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Find file type from picturebox

    Is there any way of finding out what type an image is when embedded in a picturebox.

    For example, if someone loaded "C:\mypicture.jpg" into a picturebox then how can I find out if the image is jpg or bmp without knowing the source ?

    Parksie

  2. #2
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Find file type from picturebox

    You can't
    Once it's in the picturebox it has lost all information of where it came from.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Find file type from picturebox

    If you populate a .NET 2.0 PictureBox by calling the Load method or by setting the ImageLocation property then the original file path will be accessible via the ImageLocation property. This beats using Image.FromFile as it doesn''t lock the file either.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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