How to tell Picturebox what the imagefile is RRS feed

  • Question


    Hello All,


    I want to programmatically set the image of a pictuurebox.


    When I the following,  I get a compile error  saying that 

    "Value of type String cannot be converted to 'System.Drawing.Image'"


    PictureBox1.Image = TextBox2.Text


    I allow the user to select a file of type *.ico,  when they do I want to show that ico graphic in the Picturebox.


    Does anyone know how I can do this ?







    Monday, February 11, 2008 8:32 AM


  • If TextBox2.Text is an image file location use PictureBox1.Image = Image.FromFile(TextBox2.Text)

    Monday, February 11, 2008 11:12 AM