Use of resource images

S

Samuel

Hi

I added a Resource file to my application then I added 2 images to this file

I made sure to set the set the Build Option of the images to 'Embedded
Resource'

But I still can't find them

I tried the following 2 methods

1. Dim rm As New Resources.ResourceManager("Images", _
System.Reflection.Assembly.GetExecutingAssembly())
Dim bmUK As Bitmap = CType(rm.GetObject("UKFlag.bmp"), Image)

The error I get is that the application can't find this image
The name of the Resource file is Images

Method 2
Dim bmAmazonUK As Bitmap = New Bitmap(
System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream("UKFlag.bmp"))
'

Any advice will be appreciated

Thank you,
Samuel
 
H

Herfried K. Wagner [MVP]

Samuel said:
I added a Resource file to my application then I added 2 images to this
file

I made sure to set the set the Build Option of the images to 'Embedded
Resource'

But I still can't find them

If you are using VB 2005/2008, you can access the resource via
'My.Resources.<resource name>'. The advantage of this method is that access
to resources is bound at compile time and thus type-checked.
 
S

Samuel

Thanks


Herfried K. Wagner said:
If you are using VB 2005/2008, you can access the resource via
'My.Resources.<resource name>'. The advantage of this method is that
access to resources is bound at compile time and thus type-checked.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top