473,394 Members | 2,071 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,394 software developers and data experts.

How to transfer file in .resx and transfer to Strem

ad
I wnat to load a file in an .resx file and transfer the file to a stream.
How can I do?
May 10 '06 #1
6 4574
well resx is itself a file so if you see question its like uploading file and
another file .... but anyways you can open file to upload and read it using
classes in System.IO namespace and then can convert those bytes into
BASE64String using system.text namespace classes and save this string to resx
file. At the time of retrieving you can then decode this Base64String.
"ad" wrote:
I wnat to load a file in an .resx file and transfer the file to a stream.
How can I do?

May 10 '06 #2
well resx is itself a file so if you see question its like uploading file in
another file .... but anyways you can open file to upload and read it using
classes in System.IO namespace and then can convert those bytes into
BASE64String using system.text namespace classes and save this string to resx
file. At the time of retrieving you can then decode this Base64String.
"ad" wrote:
I wnat to load a file in an .resx file and transfer the file to a stream.
How can I do?

May 10 '06 #3
ad
Thanks,
I mean for example: I have a Excel file stored in a Resource File.
How can I retrive the Excel file?

"Altaf Al-Amin Najwani" <Al****************@discussions.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D:0A********************************* *@microsoft.com...
well resx is itself a file so if you see question its like uploading file
in
another file .... but anyways you can open file to upload and read it
using
classes in System.IO namespace and then can convert those bytes into
BASE64String using system.text namespace classes and save this string to
resx
file. At the time of retrieving you can then decode this Base64String.
"ad" wrote:
I wnat to load a file in an .resx file and transfer the file to a stream.
How can I do?

May 10 '06 #4
ok , I can't give u exact code here as i dont have VS.Net with me right now
... But lets start, You can use system.IO namespace
Create object of FileStream Providing name of file and filemode which is open
Then Read file using objFileStream.Read(byteArray,offset, length)
After Read you will get whole file in byteArray in form of bytes.
Now you can use Convert.ToBase64String(byteArray) to convert this file as
Base64String and store this string in resx file. You can also store file name
in resx file too. While Retrieving Read Base64String from resource file ,
again convert it back to bytearray, Create FileStream and save this
byteStream as filename stored in resx file.

"ad" wrote:
Thanks,
I mean for example: I have a Excel file stored in a Resource File.
How can I retrive the Excel file?

"Altaf Al-Amin Najwani" <Al****************@discussions.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D:0A*********************** ***********@microsoft.com...
well resx is itself a file so if you see question its like uploading file
in
another file .... but anyways you can open file to upload and read it
using
classes in System.IO namespace and then can convert those bytes into
BASE64String using system.text namespace classes and save this string to
resx
file. At the time of retrieving you can then decode this Base64String.
"ad" wrote:
I wnat to load a file in an .resx file and transfer the file to a stream.
How can I do?


May 10 '06 #5
ad
Thanks,
Maybe I must express my problem more:

I have store a Excel file (name my.xls) in the Resource file of a class
library project with the IDE of VS2005.
Now I want to retrive my.xls in code:
------------------------------------------------------------------------
ResourceManager a = new ResourceManager("WillNs.MyResource",
Assembly.GetExecutingAssembly());

Byte[] byteExcel = a.GetObject("my", CultureInfo.CurrentCulture);
-------------------------------------------------------------------------

Now how can I transfer the Byte[] to Stream?

"Altaf Al-Amin Najwani" <Al****************@discussions.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D:89********************************* *@microsoft.com...
ok , I can't give u exact code here as i dont have VS.Net with me right
now
.. But lets start, You can use system.IO namespace
Create object of FileStream Providing name of file and filemode which is
open
Then Read file using objFileStream.Read(byteArray,offset, length)
After Read you will get whole file in byteArray in form of bytes.
Now you can use Convert.ToBase64String(byteArray) to convert this file as
Base64String and store this string in resx file. You can also store file
name
in resx file too. While Retrieving Read Base64String from resource file ,
again convert it back to bytearray, Create FileStream and save this
byteStream as filename stored in resx file.

"ad" wrote:
Thanks,
I mean for example: I have a Excel file stored in a Resource File.
How can I retrive the Excel file?

"Altaf Al-Amin Najwani" <Al****************@discussions.microsoft.com>
???gco?l¢Do¡Ps?D:0A******************************* ***@microsoft.com...
> well resx is itself a file so if you see question its like uploading
> file
> in
> another file .... but anyways you can open file to upload and read it
> using
> classes in System.IO namespace and then can convert those bytes into
> BASE64String using system.text namespace classes and save this string
> to
> resx
> file. At the time of retrieving you can then decode this Base64String.
>
>
> "ad" wrote:
>
>> I wnat to load a file in an .resx file and transfer the file to a
>> stream.
>> How can I do?
>>
>>
>>


May 10 '06 #6
MemoryStream m = new MemoryStream(byteExcel)

"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:uF**************@TK2MSFTNGP02.phx.gbl...
Thanks,
Maybe I must express my problem more:

I have store a Excel file (name my.xls) in the Resource file of a class
library project with the IDE of VS2005.
Now I want to retrive my.xls in code:
------------------------------------------------------------------------
ResourceManager a = new ResourceManager("WillNs.MyResource",
Assembly.GetExecutingAssembly());

Byte[] byteExcel = a.GetObject("my", CultureInfo.CurrentCulture);
-------------------------------------------------------------------------

Now how can I transfer the Byte[] to Stream?

"Altaf Al-Amin Najwani" <Al****************@discussions.microsoft.com>
¼¶¼g©ó¶l¥ó·s»D:89********************************* *@microsoft.com...
ok , I can't give u exact code here as i dont have VS.Net with me right
now
.. But lets start, You can use system.IO namespace
Create object of FileStream Providing name of file and filemode which is
open
Then Read file using objFileStream.Read(byteArray,offset, length)
After Read you will get whole file in byteArray in form of bytes.
Now you can use Convert.ToBase64String(byteArray) to convert this file as
Base64String and store this string in resx file. You can also store file
name
in resx file too. While Retrieving Read Base64String from resource file ,
again convert it back to bytearray, Create FileStream and save this
byteStream as filename stored in resx file.

"ad" wrote:
Thanks,
I mean for example: I have a Excel file stored in a Resource File.
How can I retrive the Excel file?

"Altaf Al-Amin Najwani" <Al****************@discussions.microsoft.com>
???gco?l¢Do¡Ps?D:0A******************************* ***@microsoft.com...
> well resx is itself a file so if you see question its like uploading
> file
> in
> another file .... but anyways you can open file to upload and read it
> using
> classes in System.IO namespace and then can convert those bytes into
> BASE64String using system.text namespace classes and save this string
> to
> resx
> file. At the time of retrieving you can then decode this Base64String.
>
>
> "ad" wrote:
>
>> I wnat to load a file in an .resx file and transfer the file to a
>> stream.
>> How can I do?
>>
>>
>>


May 10 '06 #7

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

Similar topics

0
by: qh0st | last post by:
Hi all. I have a frustrating issue that I can't seem to figure out. EXPERTS please help me~! Deadline is coming up soon~! My task is to localize a winform application. The .Net Designer...
1
by: Namratha Shah \(Nasha\) | last post by:
Hi All, This is a resource file generation tool which converts an xml based resource formats to .net resource file i.e. (.resources) and vice-versa. Today we will see how we will generate ...
0
by: David Krussow | last post by:
I had an aspx page (mypage.aspx) with a code behind file (mypage.aspx.cs) that in turn had a resx file (mypage.aspx.resx). I decided to create another aspx page (myotherpage.aspx) that would reuse...
0
by: prabhupr | last post by:
Hi Folks I'm currently working on a Localization+Globalization project; for this project, we need to generate ".Resx" files and we use "US English" Resx file as the base version, to compare the...
0
by: Steave | last post by:
Hi, using Managed C++ (.Net 2.0), I want to embed some images within an executable using a .resX file, and upon an event (in this case a combo box changing), I want the picture box to update with a...
0
by: Rahul | last post by:
Hi I have a Project A that is being reffered by another WEB project Webber. In Project A i am using a resx file to store some information in it. I have m1de the Build Action of the Resx file to...
5
by: Ryan Liu | last post by:
Hi, Both way works, I'd just ask some experts which way is better? My application creates a log file daily. Now each time when I write a log, I will open the file and append to the end....
12
by: TS | last post by:
i have a need to possibly enable mutli language support. What benefit do i get by using a resource file instead of a custom xml solution? thanks!
8
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...
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...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.