Results 1 to 6 of 6

Thread: Changing the image in a picturebox with Code

  1. #1

    Thread Starter
    Member Aerials's Avatar
    Join Date
    Jul 2002
    Location
    Chile
    Posts
    50

    Changing the image in a picturebox with Code

    I thought I'd posted this somewhere...

    Oh well
    This might sound like a stupid question but im a newbie so bear with me
    How do I make a button change the image in a picture box?
    How do i set the image property from code?

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    this works for me:
    VB Code:
    1. PictureBox1.Image = New Drawing.Bitmap("C:\somePic.bmp")

  3. #3
    Member
    Join Date
    Jul 2002
    Posts
    49
    Or you could use this method to support more file types

    PictureBox1.Image = Image.FromFile("C:\logo.gif")

  4. #4
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    more file types?! eeeh, which supports what?

  5. #5
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Drawing.Bitmap also support Gif, Jpeg, tiff, png, ico
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  6. #6
    Member
    Join Date
    Jul 2002
    Posts
    49

    Talking

    Opps, sorry about that.

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