473,396 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How do Embed a file as a resource?

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
3 2209
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eric Barr | last post by:
I've found myself using XSD files for my datasets. I'm loading them up from disk right now. I was hoping there was a way to embed the file in the assembly, so I could have access to it without...
10
by: Yogi_Bear_79 | last post by:
pardon my ignorance as I am a self-taught hobbyist programmer. I am curious after reading up on SharpZipLib. Can I embed a zipped txt file in my program? Then either read from within the zip...
2
by: David | last post by:
Hello, I'm using an xml schema (xsd file) to validate input xml. This xsd is used by the C# dll and must be distributed with it. The xsd isn't modified. So I would like to embed it in the DLL so...
4
by: David | last post by:
I have an application that creates a database from a text file of DDL (generated by Visio). Currently I have to deploy the text file with my application and open it using the statement: SQL =...
0
by: John | last post by:
Hi This is my question: I have an Exe and a .resource that i modify with Lutz Resourcer. I can't manage to embed the modified resource file in the exe with al.exe. al.exe myexe.exe...
8
by: CodeLeon | last post by:
Hi, All. I am creating a setup program. The way it works is that the user creates their setup info, my program generates the C# code for a setup executable, embeds the xml file containing the info...
4
by: bern11 | last post by:
How do you embed a custom cursor? The help says: // On the command line: // Add the following flag: // /res:CursorFileName.Cur,Namespace.CursorFileName.Cur What if you are...
8
by: Tomasz J | last post by:
Hello Developers, It may sound like a stupid question, but how to embed a resource in ASP.Net 2.0 web application? I mean, without using a separate library. There is no "build action" property....
0
by: VigneshS | last post by:
Hi, I am a newbie to Globalization and Localisation Concepts. I tried almost all the methods of the Globalization concepts. But i cannot be able to embed a text file within a Resource. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.