Click here to Skip to main content
15,909,445 members
Home / Discussions / C#
   

C#

 
GeneralRe: Modal Forms Pin
Bo Hunter6-May-03 12:43
Bo Hunter6-May-03 12:43 
GeneralAnother IE Browser problem Pin
Tomas Petricek30-Apr-03 10:18
Tomas Petricek30-Apr-03 10:18 
GeneralRe: Another IE Browser problem Pin
Stephane Rodriguez.30-Apr-03 11:15
Stephane Rodriguez.30-Apr-03 11:15 
GeneralRe: Another IE Browser problem Pin
Tomas Petricek30-Apr-03 12:49
Tomas Petricek30-Apr-03 12:49 
GeneralData Grid Pin
Andrei Matei30-Apr-03 10:05
Andrei Matei30-Apr-03 10:05 
GeneralResource files Pin
Kant30-Apr-03 8:28
Kant30-Apr-03 8:28 
GeneralRe: Resource files Pin
Stephane Rodriguez.30-Apr-03 9:13
Stephane Rodriguez.30-Apr-03 9:13 
GeneralRe: Resource files Pin
Daniel Turini30-Apr-03 9:36
Daniel Turini30-Apr-03 9:36 
Because in .NET you can add an entire set of files, easily to any assembly.

1. Click on the file you want to add as a resource to your application and on the Build Action select "Embedded Resource"
2. Your code will need to be a little more complicated. You'll need to do something like this (I'm not in the IDE ATM, but you'll get the idea):
private System.Drawing.Icon myTrayIcon;

Assembly asm = Assembly.GetExecutingAssembly();
using (Stream st = asm.GetManifestResourceStream(asm.GetName().Name + "." + "Icon1.ico")))
{
    myTrayIcon = new Icon(st);
}


See? The embedded resources are available as streams. You you think twice, this is very powerful, as anything that can take a Stream as a parameter can use a resource, without any need for special treatment for resources, like in MFC. You can easily create encrypted or compressed resources with it, too.

And, contrary to what S.Rod. has said, you can add any file as a resource. The only drawback is that it won't be a Win32 resource, but as long as you keep with managed code, you won't have any trouble.

My latest article: GBVB - Converting VB.NET code to C#
GeneralRe: Resource files Pin
Stephane Rodriguez.30-Apr-03 9:42
Stephane Rodriguez.30-Apr-03 9:42 
GeneralRe: Resource files Pin
Daniel Turini30-Apr-03 9:50
Daniel Turini30-Apr-03 9:50 
GeneralRe: Resource files Pin
Kant30-Apr-03 10:27
Kant30-Apr-03 10:27 
QuestionTrying access Browser of NewWindow ? Pin
Mike Keith30-Apr-03 8:18
Mike Keith30-Apr-03 8:18 
AnswerRe: Trying access Browser of NewWindow ? Pin
Stephane Rodriguez.30-Apr-03 9:09
Stephane Rodriguez.30-Apr-03 9:09 
GeneralRe: Trying access Browser of NewWindow ? Pin
Mike Keith1-May-03 7:28
Mike Keith1-May-03 7:28 
Generalappend RTF text Pin
Manish K. Agarwal30-Apr-03 7:05
Manish K. Agarwal30-Apr-03 7:05 
GeneralRe: append RTF text Pin
J. Dunlap30-Apr-03 8:25
J. Dunlap30-Apr-03 8:25 
GeneralRe: append RTF text Pin
Manish K. Agarwal30-Apr-03 17:43
Manish K. Agarwal30-Apr-03 17:43 
GeneralWindow Maximize Problem Pin
Amauw Scritz30-Apr-03 7:02
Amauw Scritz30-Apr-03 7:02 
GeneralRe: Window Maximize Problem Pin
Stephane Rodriguez.30-Apr-03 9:18
Stephane Rodriguez.30-Apr-03 9:18 
GeneralRe: Window Maximize Problem Pin
Amauw Scritz2-May-03 20:14
Amauw Scritz2-May-03 20:14 
Generalref string Pin
Le centriste30-Apr-03 6:00
Le centriste30-Apr-03 6:00 
GeneralRe: ref string Pin
Daniel Turini30-Apr-03 6:38
Daniel Turini30-Apr-03 6:38 
GeneralRe: ref string Pin
Le centriste30-Apr-03 9:13
Le centriste30-Apr-03 9:13 
GeneralMaking a file writable.. Pin
Le centriste30-Apr-03 5:55
Le centriste30-Apr-03 5:55 
GeneralSolved Pin
Le centriste30-Apr-03 9:14
Le centriste30-Apr-03 9:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.