By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,650 Members | 1,785 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,650 IT Pros & Developers. It's quick & easy.

How do Embed a file as a resource?

P: n/a
M
Hi Folks,

Does anyone know how to embed a file into a resource in C#? You
seem to be able to embed Icon, Bitmap, Cursor's & Strings. But how do you
embed a file???

In VC++ version 6 you would, Find the Resource, Load It, get its size, and
then write it out to where ever you want it.

Any help would be most appreciated.

Cheers,

Martin


Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi M,

Select file in Solution Explorer, go to Properties and set Build Action to
Embedded Resource.

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com

"M" <a1*****@ic24.net> wrote in message
news:vv************@corp.supernews.com...
Hi Folks,

Does anyone know how to embed a file into a resource in C#? You seem to be able to embed Icon, Bitmap, Cursor's & Strings. But how do you
embed a file???

In VC++ version 6 you would, Find the Resource, Load It, get its size, and
then write it out to where ever you want it.

Any help would be most appreciated.

Cheers,

Martin

Nov 15 '05 #2

P: n/a
M
Hi Miha Markic,
Select file in Solution Explorer, go to Properties and set Build Action to
Embedded Resource.
AND ????????

How do I Serialize it out?????

The Icon Bitmap & Cursor Classes ALL have special constructors ie
Class(GetType(),"FileName");

If the file was for instance an MS-Access Database file, how do you copy it
to the required location????

Martin

"Miha Markic" <miha at rthand com> wrote in message
news:ex**************@TK2MSFTNGP10.phx.gbl... Hi M,

Select file in Solution Explorer, go to Properties and set Build Action to
Embedded Resource.

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com

"M" <a1*****@ic24.net> wrote in message
news:vv************@corp.supernews.com...
Hi Folks,

Does anyone know how to embed a file into a resource in C#?

You
seem to be able to embed Icon, Bitmap, Cursor's & Strings. But how do you embed a file???

In VC++ version 6 you would, Find the Resource, Load It, get its size, and then write it out to where ever you want it.

Any help would be most appreciated.

Cheers,

Martin


Nov 15 '05 #3

P: n/a
Hi M,
"M" <a1*****@ic24.net> wrote in message
news:vv************@corp.supernews.com...
Hi Miha Markic,
Select file in Solution Explorer, go to Properties and set Build Action to Embedded Resource.


AND ????????

How do I Serialize it out?????


Check out Assembly.GetManifestResourceStream method.

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com
Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.