"Page.Clientscript" does not compile in assembly, with the error message
"Reference to a non-shared member requires an object reference". ...
what reference is it looking for ??????
class class1
public sub showimg()
Dim Response As HttpResponse = HttpContext.Current.Response
Dim theImage As New object
theImage.ImageUrl =
Page.ClientScript.RegisterStartupScript.GetWebReso urceUrl(Me.GetType(),
"img.gif")
response.write( "<img src=""" & theImage & """>")
end sub
end class
Apparently this code is not in an aspx/ascx codebehind, but in an
"external" class. "Page" is not some system-wide global variable, but a
property of the Control class. That is why you can use it there, but
not here. You need to pass a reference to your page to this function.
public sub showimg(MyPage as System.Web.UI.Page)
....
theImage.ImageUrl = MyPage.Register....
Remark 2: I don't know VB that well, but if you declare "theImage" as a
plain "object", does it recognise properties like "ImageUrl" (which is
not a property of "object")?
Remark 3: I'm not sure the line "<img src=""" & theImage & """>" will
give the required result. Why not directly put the URL you get from the
WebResource here?
Hans Kesting