Picture Into FormView Image Object

Discussion in 'ASP.NET / ASP.NET Core' started by dbireporter, Dec 21, 2010.

  1. In VB code of an ASP 3.5 page, I want to put an uploaded image into an image object on a FormView. My code looks like this:

    FormView1.ChangeMode(FormViewMode.Edit)
    Dim pictureIMG As Image = CType(FormView1.FindControl("Image2"), Image)
    pictureIMG.DescriptionUrl = filePath & fileName

    Where filepath and fileName are strings set equal to the correct path & filename on my local machine..

    When I run the page on the local machine, I get this error message:

    "Object reference not set to an instance of an object."

    Any idea what I'm doing wrong?
     

Share This Page