Question external resources file

ExEdzy

Active member
Joined
Nov 25, 2010
Messages
37
Programming Experience
3-5
Hey everyone :)

So i have a little problem..
The thing is im making formless application, thats visible in tray only..
But i have like 21 icons for default functions..
and when my program launches all icons with the exe file is loaded in RAM.
Is there a way to use an external resources file, where all the icons is stored, so when application needs one it takes it from rscx file and loads it, and when it needs other icon it releases the one taken and takes other..

Im asking this not just for ico files, but for any file types that can be stored in my.resources..
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,558
Location
Norway
Programming Experience
10+
You can add image files to the project, perferable in a subfolder. File property Build Action should be 'Content' and property Copy To Output Directory one of the 'Copy' options. At runtime load the file from file system, for example:
VB.NET:
Me.Icon = New Icon(IO.Path.Combine(Application.StartupPath, "images\some.ico"))
If you prefer these files to be in a single resource set file you can generate a compiled .resources file using ResourceWriter class from System.Resources namespace. Add it to the project same as above and use the ResourceSet class from same namespace to load a resource from this file at runtime.
 

ExEdzy

Active member
Joined
Nov 25, 2010
Messages
37
Programming Experience
3-5
Tnx man, you answered on my other projects problem :D
But still.. how can i write those files in resource file?
i know how to add resources file to project and Resources namespace, but how can i create the actual file?
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,558
Location
Norway
Programming Experience
10+
Tnx man, you answered on my other projects problem :D
But still.. how can i write those files in resource file?
i know how to add resources file to project and Resources namespace, but how can i create the actual file?
I may be misunderstanding you now, but I believe I explained that:
me said:
you can generate a compiled .resources file using ResourceWriter class
 
Top Bottom