M
Mark Denardo
I'm having a problem when building a Custom Control that includes embedded WebResources. (using VB.NET 2.0)
My namespace I'm using is: myCompany.CustomControl
And the image I'm trying to reference is: Images/myImage.gif
From reading my .NET books and looking through numerous articles on WebResources, the way I should be able to use this in code seems to be something like so:
=> I declare it like so:
<Assembly: WebResource("myCompany.CustomControls.Images.myImage.gif", "image/gif")>
=> And later reference it like so:
myImage = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "myCompany.CustomControls.Images.myImage.gif")
But this didn't work. But after playing around, I changed my Namespace to myCompanyCustomControls (took out the dot reference)
and moved myImage.gif to the root level and then used:
<Assembly: WebResource("myCompanyCustomControls.myImage.gif", "image/gif")>
myImage = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "myCompanyCustomControls.myImage.gif")
and then it worked.
I tried a number of different things, but cannot get anything working with any additional dot references.
Now I can live with leaving my resources in the root directory, but I need my Namespace to be myCompany.CustomControls
Anyone see what I may be doing wrong. All of the example articles on the internet are in C# and frankly so are my books (C# is my primary language, but my company uses VB.NET). I wondering if I need to do something special in VB?
Any help on this would be much appreciated.
Mark
My namespace I'm using is: myCompany.CustomControl
And the image I'm trying to reference is: Images/myImage.gif
From reading my .NET books and looking through numerous articles on WebResources, the way I should be able to use this in code seems to be something like so:
=> I declare it like so:
<Assembly: WebResource("myCompany.CustomControls.Images.myImage.gif", "image/gif")>
=> And later reference it like so:
myImage = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "myCompany.CustomControls.Images.myImage.gif")
But this didn't work. But after playing around, I changed my Namespace to myCompanyCustomControls (took out the dot reference)
and moved myImage.gif to the root level and then used:
<Assembly: WebResource("myCompanyCustomControls.myImage.gif", "image/gif")>
myImage = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "myCompanyCustomControls.myImage.gif")
and then it worked.
I tried a number of different things, but cannot get anything working with any additional dot references.
Now I can live with leaving my resources in the root directory, but I need my Namespace to be myCompany.CustomControls
Anyone see what I may be doing wrong. All of the example articles on the internet are in C# and frankly so are my books (C# is my primary language, but my company uses VB.NET). I wondering if I need to do something special in VB?
Any help on this would be much appreciated.
Mark