Senkwe Chanda wrote: Hi guys, simple question, how do you use resource files in C#? For example, suppose I create an icon using the editor in VS .NET and the file is named icon1.ico, how would I the go about referencing that file from my code? In VS.NET click on your icon in the Solution Explorer then in the properties box change the Build Action to "Embedded Resource". Now when you build your project you can get a stream to the file from the assembly.
System.Reflection.Assembly asm = GetType().Assembly;
System.IO.Stream = asm.GetManifestResourceStream("myDefaultNamespace.myFolder.Icon1.ico"));
The string that is passed in is a tad difficult to understand at first. myDefaultNamespace is the namespace that is assigned by default to new classes that are added to your project. You can see what this is by going into the properties for your project. If you create a folder within your project and place icons in there, then you also append the folder names to the namespace (if you haven't noticed it -- when you create a folder, any classes created inside that folder have the folder name appended to the default namespace); finally append the filename. In the example above i have an icon named Icon1.ico located in a folder called myFolder in my project with a default namespace of myDefaultNamespace. It is possible to set the default namespace to nothing, in which case you use the folder (if any) and the filename. HTH, James Sonork ID: 100.11138 - Hasaki "My words but a whisper -- your deafness a SHOUT. I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972