473,725 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Text file as embedded resource

I have a text file(.js) that holds a buch of java script code that is
rendered in some web controls all part of a larger webcontrol library.

The file is rather large. Would embedding this resouce in the application
be relevant in this situation. I know I can chage the build type to
embedded resource but really dont know what this does. Besides that it
embeds it in the assembly ;-). I'm pretty quick.

How can I read the text file once its embedded though. Like I metioned
there are a couple webcontrols that use this text file and render out some
of the contents.

Thanks,
Ron
Nov 15 '05 #1
3 22647

Hi Ron,

You can refer to Assembly.GetMan ifestResourceSt ream method, it will read
the resource into a stream.
Then you can use filestream to operate it as you like.

For details, please refer to:
http://www.codeproject.com/dotnet/em...asp?print=true
http://www.devx.com/dotnet/Article/10831/0/page/2

Also, you can use ResourceManager Class to retrieve embedded resources at
run time.
You can visit:
http://msdn.microsoft.com/library/de...us/vbcon/html/
vbtskretrieving resourceswithre sourcemanager.a sp

If you still have anything unclear, please feel free to let me know.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Ron Vecchi" <rv*****@xilehd vecchi.com>
| Subject: Text file as embedded resource
| Date: Mon, 20 Oct 2003 18:45:32 -0400
| Lines: 16
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.3790.0
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Message-ID: <O4************ **@tk2msftngp13 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| NNTP-Posting-Host: pcp02828467pcs. roylok01.mi.com cast.net 68.85.156.233
| Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!tk2 msftngp13.phx.g bl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1927 11
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
|
| I have a text file(.js) that holds a buch of java script code that is
| rendered in some web controls all part of a larger webcontrol library.
|
| The file is rather large. Would embedding this resouce in the application
| be relevant in this situation. I know I can chage the build type to
| embedded resource but really dont know what this does. Besides that it
| embeds it in the assembly ;-). I'm pretty quick.
|
| How can I read the text file once its embedded though. Like I metioned
| there are a couple webcontrols that use this text file and render out some
| of the contents.
|
| Thanks,
| Ron
|
|
|

Nov 15 '05 #2
Look at Assembly.GetMan ifestResourceSt ream.

private Stream GetFileStream(s tring Path)
{
Assembly assembly = Assembly.GetExe cutingAssembly( );
return assembly.GetMan ifestResourceSt ream(Path);
}

HTH;
Eric Cadwell
http://www.origincontrols.com
Nov 15 '05 #3
Great this should get me going, Thanks
"Ron Vecchi" <rv*****@xilehd vecchi.com> wrote in message
news:O4******** ******@tk2msftn gp13.phx.gbl...
I have a text file(.js) that holds a buch of java script code that is
rendered in some web controls all part of a larger webcontrol library.

The file is rather large. Would embedding this resouce in the application
be relevant in this situation. I know I can chage the build type to
embedded resource but really dont know what this does. Besides that it
embeds it in the assembly ;-). I'm pretty quick.

How can I read the text file once its embedded though. Like I metioned
there are a couple webcontrols that use this text file and render out some
of the contents.

Thanks,
Ron

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1790
by: Ola Theander | last post by:
Dear subscribers I'm currently creating a small application that will run at the end of a web installation to configure a SQL Server. For this task I have a SQL batch file in the same format as SQL Query Analyzer uses. I would prefer not to merge the content of this file into the source code of configuration application but instead keep the SQL commands in a text file included in the executable, pretty much like resource data, for...
1
24178
by: james | last post by:
What class / method should I be using to get the full path to an embedded resource ? In my case I have an .xml file that my app uses, it is set as embedded resource, and I have a control that needs to load it, but I do not want to hard code the path since that may change for different installs. i.e. GetPathForResourceOfName ( myResourceFileName ) thanks, JIM
4
4933
by: Patrick Blackman | last post by:
I have a text file embedded in my dll, how can I load that file without using the GetManifestResourceStream of the Assembly class, I want to read it as if it was just located in my c:\my document folder. Any ideas?
10
4521
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 file or unzip and read it? I currently have an embedded text file that contains a list that is read into an array. I'm always looking to save space. And I could reduce my file size 75% if it was zipped! I have looked at the SharpZipLib web site,...
1
2237
by: Bruce | last post by:
I would like to store a text file as an embedded resource, and then at runtime read it in as if it were a text file on the hard drive. Is this possible? --Bruce
14
2366
by: J.S. | last post by:
In a Windows Form application, which is the better method to concatenate large blocks of code? 1. Reading the text from text files. 2. Adding the text to the VB file itself? Thanks! J.S. --
4
6519
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 = My.Computer.FileSystem.ReadAllText("CreateDB.SQL"). This works fine, but I would prefer not to have to deploy a separate text file, and I would like to prevent the users from having access to this file. Is there some way to easily embed the text...
1
6594
by: Ryan Liu | last post by:
"j1mb0jay" <j1mb0jay@uni.ac.ukдÈëÏûÏ¢ÐÂÎÅ:s0dmg5x4el.ln2@news.aber.ac.uk... Thanks, j1mbjay. Then what is the difference betweeen "Content" and "Embedded"? What is the difference between put a file in Resource (folder) or just in project? Thanks!
8
14941
by: raylopez99 | last post by:
I have the latest version of Visual Studio 2008 Professional, which allows you to create resource files (this is the .resx file, no?), unlike the Express version, which does not. I am trying to cut and paste code that MSDN recommends for playing a simple wav file from inside an embedded file, like presumeably the 'resources' file .resx is. I want to embed the .wav file in a 'resource file' since I don't want the user storing the file on...
0
8752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9113
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.