Hi
I'm new to Teleric and am struggling to dynamically load a picture into a PictureBox. No matter what I try I get "Could not find part of the path". I found this function in an article on User Functions but it doesn't work: I get the same error message and "Invalid URL: the url is empty":
--------------------------------------------------------------------------------------------------------------------------------
Private Sub PictureBoxRecipePicture_ItemDataBinding(sender As Object, e As EventArgs) Handles PictureBox1.ItemDataBinding
Try
Me.PictureBox1.Value = ResolveUrl("C:\MyPictures\MyPicture.jpg")
Catch ex As Exception
Finally
End Try
End Sub
Public Shared Function ResolveUrl(relativeUrl As String) As System.Drawing.Image
Dim path As String = System.Web.HttpContext.Current.Server.MapPath(relativeUrl)
Return System.Drawing.Image.FromFile(path)
End Function
--------------------------------------------------------------------------------------------------------------------------------
Can anyone point me in the right direction for how to do this? I realise there may be a much better way of dynamically assigning pictures but simply can't find a method that works.
Thanks for reading
Richard