Resource File Usage is an absolute nightmare 
Author Message
 Resource File Usage is an absolute nightmare

I have posted this question before and thought it had been answered but have
come to use resource files again only to find all the examples on this group
don't work or are not applicable.
ALL I WANT TO DO IS EMBEDD A ICON/BITMAP RESX FILE WITH MY APPLICATION AND
THEN READ IT INTO  SOME SPECIFIC VARIABLES.
Please,please could some one show me an example of how to do this. PLEASE DO
NOT POST A LINK TO THE PATHETIC HELP FILES WHICH I HAVE JUST WASTED 4 HOURS
ON AND GOT NO WHERE.

I thought is would be a simple

Attempt 1
Dim _Ico as icon
Dim rm As ResourceManager =
ResourceManager.CreateFileBasedResourceManager("MyRes", ".", Nothing)

 _icon = ctype(rm.GetObject("Save1.ico"),icon)

Attempt 2

Dim _Ico as icon

Dim rm As New
Resources.ResourceManager("MyRes",System.Reflection.Assembly.GetExecutingAss
embly)
_ icon =ctype( rm.GetObject("Save1.ico"),icon)

Both cases fail on the _icon assignment saying the resource file could not
be found. The usual "please check that it is linked" unhelpful help
response.

The MyRes.resx file is an embedded resource in my project.

It's nothing to do with the file format either as I have tried it as an
object and bitmap. Still no good.

Why does this not work and how can I lower my {*filter*} pressure!!!!

Thanks



Thu, 27 Jan 2005 20:11:21 GMT  
 Resource File Usage is an absolute nightmare
Main Program code, get an icon (dropped this icon into the solution explore
so it became a resource for this project)
cmdInformation.Image = GetIcon(Me, ".InfoEnabled.ico").ToBitmap

Function Code for getting the icon out of the Resource.

Public Function GetIcon(ByVal Ob As Object, ByVal szBitmapName As String) As
System.Drawing.Icon
Dim Ass As Reflection.Assembly

Dim appIcon As System.Drawing.Icon

Ass = Ob.GetType().Module.Assembly

appIcon = New
System.Drawing.Icon(Ass.GetManifestResourceStream("YourClass/App Name" &
szBitmapName))

Return appIcon

End Function

Hope this helps

Andrew Stewart


Quote:
> I have posted this question before and thought it had been answered but
have
> come to use resource files again only to find all the examples on this
group
> don't work or are not applicable.
> ALL I WANT TO DO IS EMBEDD A ICON/BITMAP RESX FILE WITH MY APPLICATION AND
> THEN READ IT INTO  SOME SPECIFIC VARIABLES.
> Please,please could some one show me an example of how to do this. PLEASE
DO
> NOT POST A LINK TO THE PATHETIC HELP FILES WHICH I HAVE JUST WASTED 4
HOURS
> ON AND GOT NO WHERE.

> I thought is would be a simple

> Attempt 1
> Dim _Ico as icon
> Dim rm As ResourceManager =
> ResourceManager.CreateFileBasedResourceManager("MyRes", ".", Nothing)

>  _icon = ctype(rm.GetObject("Save1.ico"),icon)

> Attempt 2

> Dim _Ico as icon

> Dim rm As New

Resources.ResourceManager("MyRes",System.Reflection.Assembly.GetExecutingAss

- Show quoted text -

Quote:
> embly)
> _ icon =ctype( rm.GetObject("Save1.ico"),icon)

> Both cases fail on the _icon assignment saying the resource file could not
> be found. The usual "please check that it is linked" unhelpful help
> response.

> The MyRes.resx file is an embedded resource in my project.

> It's nothing to do with the file format either as I have tried it as an
> object and bitmap. Still no good.

> Why does this not work and how can I lower my {*filter*} pressure!!!!

> Thanks



Fri, 28 Jan 2005 06:34:37 GMT  
 Resource File Usage is an absolute nightmare

Hi Andrew

Thanks for the reply.

I have already worked out how to access an isolated embedded resource
file. I wanted to specifically to list my files in a resx resource file.
I have used a third party resource file application that allows me to
create resource/rex files. I'm just lost as to how I access them in my
application.

Thanks anyway

Paul

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Fri, 28 Jan 2005 20:25:20 GMT  
 Resource File Usage is an absolute nightmare
Hi

Thanks for the post.
Unfortunately I cannot detach your file. could you send it to

Many thanks



Quote:
> Attached is a demo solution.

> Pay particular attention to the name of the root namespace assigned to the
> assembly and the names of the items being loaded from the resource file.

> Hope it helps.



> > Hi Andrew

> > Thanks for the reply.

> > I have already worked out how to access an isolated embedded resource
> > file. I wanted to specifically to list my files in a resx resource file.
> > I have used a third party resource file application that allows me to
> > create resource/rex files. I'm just lost as to how I access them in my
> > application.

> > Thanks anyway

> > Paul

> > *** Sent via Developersdex http://www.developersdex.com ***
> > Don't just participate in USENET...get rewarded for it!



Sat, 29 Jan 2005 03:13:43 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Usage of Resources File

2. Write in Resource Usage

3. Order of assignments in Resource Usage view

4. Enhancement of View Resource Usage by VBA

5. Accessing tasks within Resource Usage view

6. Resource Usage in a Gantt View

7. VS resource usage??

8. controls' resource usage

9. resource usage

10. VB5 and resource usage info wanted

11. Usage of 16 bit resource compiler

12. Truegrid and recordsets - excessive resource usage

 

 
Powered by phpBB® Forum Software