A1VBCode Forums

loading image from folder


http://a1vbcode.com/vbforums/Topic31399.aspx

By corkman - 5/3/2012

Hi. I am trying to load an image from  folder to an image box. This is the code I am using.

Protected Sub btnup_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnup.Click, btnup.Click, btnup.Click

If FileUpload1.HasFile Then

Try

FileUpload1.SaveAs("C:\Inetpub\wwwroot\WebApplication1\images" & _

FileUpload1.FileName)

Label1.Text = "Image Loaded"

Catch ex As Exception

Label1.Text = "ERROR: " & ex.Message.ToString()

End Try

Else

Label1.Text = "You have not specified a file."

End If

If FileUpload1.HasFile Then

Image1 = System.Drawing.Image.FromFile("C:\Inetpub\wwwroot\WebApplication1\images")

End If

End Sub

I am getting a message:value of type'system.drawing.image' cannot be converted to 'system.web.UI.webcontrols.image'   Any help with this will be gratefully appreciated.

Corkman