I have an Excel file save in the MyResource.resx.
I have to load the Excel file into strem.
I use the code:
------------------------------------------------------------------------------------------
ResourceManager a = new ResourceManager("WillNs.MyResource",
Assembly.GetExecutingAssembly());
Stream myStream = a.GetStream("Empty.xls");
------------------------------------------------------------------------------------------
But mySteam always reutn null.
How can I do? 7 11682
Hi,
most probably the name is not correct, IIRC you have to use the complete
name, which is the name of the assembly + the name of the file.
do this
foreach(string name in
Assembly.GetExecutingAssembly().GetManifiestResour ceNames() )
Console.WriteLine( name);
you will get all the names of the resources, later you can access the
correct one using
Assembly.GetExecutingAssembly().GetManifestResourc eStream( the_name);
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:Oq**************@TK2MSFTNGP04.phx.gbl... I have an Excel file save in the MyResource.resx. I have to load the Excel file into strem. I use the code: ------------------------------------------------------------------------------------------ ResourceManager a = new ResourceManager("WillNs.MyResource", Assembly.GetExecutingAssembly()); Stream myStream = a.GetStream("Empty.xls"); ------------------------------------------------------------------------------------------ But mySteam always reutn null.
How can I do?
I have do
foreach (string name in
Assembly.GetExecutingAssembly().GetManifestResourc eNames())
Console.WriteLine(name);
but the name always is "WillNs.MyResource.resources"
I have put a Empty.xls in the WillNs.MyResource, but it still can't get the
name of the file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> ¼¶¼g©ó¶l¥ó·s»D:ef**************@TK2MSFTNGP05.phx.g bl... Hi,
most probably the name is not correct, IIRC you have to use the complete name, which is the name of the assembly + the name of the file.
do this
foreach(string name in Assembly.GetExecutingAssembly().GetManifiestResour ceNames() ) Console.WriteLine( name);
you will get all the names of the resources, later you can access the correct one using Assembly.GetExecutingAssembly().GetManifestResourc eStream( the_name);
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "ad" <fl****@wfes.tcc.edu.tw> wrote in message news:Oq**************@TK2MSFTNGP04.phx.gbl...I have an Excel file save in the MyResource.resx. I have to load the Excel file into strem. I use the code: ------------------------------------------------------------------------------------------ ResourceManager a = new ResourceManager("WillNs.MyResource", Assembly.GetExecutingAssembly()); Stream myStream = a.GetStream("Empty.xls"); ------------------------------------------------------------------------------------------ But mySteam always reutn null.
How can I do?
It is actually the default namespace .. it just happens this to often be the
identical :)
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:ef**************@TK2MSFTNGP05.phx.gbl... Hi,
most probably the name is not correct, IIRC you have to use the complete name, which is the name of the assembly + the name of the file.
do this
foreach(string name in Assembly.GetExecutingAssembly().GetManifiestResour ceNames() ) Console.WriteLine( name);
you will get all the names of the resources, later you can access the correct one using Assembly.GetExecutingAssembly().GetManifestResourc eStream( the_name);
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "ad" <fl****@wfes.tcc.edu.tw> wrote in message news:Oq**************@TK2MSFTNGP04.phx.gbl...I have an Excel file save in the MyResource.resx. I have to load the Excel file into strem. I use the code: ------------------------------------------------------------------------------------------ ResourceManager a = new ResourceManager("WillNs.MyResource", Assembly.GetExecutingAssembly()); Stream myStream = a.GetStream("Empty.xls"); ------------------------------------------------------------------------------------------ But mySteam always reutn null.
How can I do?
Hi,
Do you mean that the only string you get is "WillNs.MyResource.resources"
Are you sure you included the file in the project and marked it as "Embedded
resource" ?
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:Oe**************@TK2MSFTNGP02.phx.gbl... I have do
foreach (string name in Assembly.GetExecutingAssembly().GetManifestResourc eNames()) Console.WriteLine(name);
but the name always is "WillNs.MyResource.resources"
I have put a Empty.xls in the WillNs.MyResource, but it still can't get the name of the file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> ¼¶¼g©ó¶l¥ó·s»D:ef**************@TK2MSFTNGP05.phx.g bl... Hi,
most probably the name is not correct, IIRC you have to use the complete name, which is the name of the assembly + the name of the file.
do this
foreach(string name in Assembly.GetExecutingAssembly().GetManifiestResour ceNames() ) Console.WriteLine( name);
you will get all the names of the resources, later you can access the correct one using Assembly.GetExecutingAssembly().GetManifestResourc eStream( the_name);
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "ad" <fl****@wfes.tcc.edu.tw> wrote in message news:Oq**************@TK2MSFTNGP04.phx.gbl...I have an Excel file save in the MyResource.resx. I have to load the Excel file into strem. I use the code: ------------------------------------------------------------------------------------------ ResourceManager a = new ResourceManager("WillNs.MyResource", Assembly.GetExecutingAssembly()); Stream myStream = a.GetStream("Empty.xls"); ------------------------------------------------------------------------------------------ But mySteam always reutn null.
How can I do?
What is Embedded resource.
I added the file in a .resx file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> ¼¶¼g©ó¶l¥ó·s»D:uX**************@TK2MSFTNGP03.phx.g bl... Hi,
Do you mean that the only string you get is "WillNs.MyResource.resources"
Are you sure you included the file in the project and marked it as "Embedded resource" ? -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "ad" <fl****@wfes.tcc.edu.tw> wrote in message news:Oe**************@TK2MSFTNGP02.phx.gbl...I have do
foreach (string name in Assembly.GetExecutingAssembly().GetManifestResourc eNames()) Console.WriteLine(name);
but the name always is "WillNs.MyResource.resources"
I have put a Empty.xls in the WillNs.MyResource, but it still can't get the name of the file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> ¼¶¼g©ó¶l¥ó·s»D:ef**************@TK2MSFTNGP05.phx.g bl... Hi,
most probably the name is not correct, IIRC you have to use the complete name, which is the name of the assembly + the name of the file.
do this
foreach(string name in Assembly.GetExecutingAssembly().GetManifiestResour ceNames() ) Console.WriteLine( name);
you will get all the names of the resources, later you can access the correct one using Assembly.GetExecutingAssembly().GetManifestResourc eStream( the_name);
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "ad" <fl****@wfes.tcc.edu.tw> wrote in message news:Oq**************@TK2MSFTNGP04.phx.gbl... I have an Excel file save in the MyResource.resx. I have to load the Excel file into strem. I use the code: ------------------------------------------------------------------------------------------ ResourceManager a = new ResourceManager("WillNs.MyResource", Assembly.GetExecutingAssembly()); Stream myStream = a.GetStream("Empty.xls"); ------------------------------------------------------------------------------------------ But mySteam always reutn null.
How can I do?
Hi,
An embedded resource is a file that is contained in the dll or exe assembly.
You do so by:
1- selecting add an existing item to a project
2- in the property tab of the added item , set Build Action to "Embedded
resource"
then you can use the code I provided before
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:e6**************@TK2MSFTNGP02.phx.gbl... What is Embedded resource. I added the file in a .resx file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> ¼¶¼g©ó¶l¥ó·s»D:uX**************@TK2MSFTNGP03.phx.g bl... Hi,
Do you mean that the only string you get is "WillNs.MyResource.resources"
Are you sure you included the file in the project and marked it as "Embedded resource" ? -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "ad" <fl****@wfes.tcc.edu.tw> wrote in message news:Oe**************@TK2MSFTNGP02.phx.gbl...I have do
foreach (string name in Assembly.GetExecutingAssembly().GetManifestResourc eNames()) Console.WriteLine(name);
but the name always is "WillNs.MyResource.resources"
I have put a Empty.xls in the WillNs.MyResource, but it still can't get the name of the file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> ¼¶¼g©ó¶l¥ó·s»D:ef**************@TK2MSFTNGP05.phx.g bl... Hi,
most probably the name is not correct, IIRC you have to use the complete name, which is the name of the assembly + the name of the file.
do this
foreach(string name in Assembly.GetExecutingAssembly().GetManifiestResour ceNames() ) Console.WriteLine( name);
you will get all the names of the resources, later you can access the correct one using Assembly.GetExecutingAssembly().GetManifestResourc eStream( the_name);
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "ad" <fl****@wfes.tcc.edu.tw> wrote in message news:Oq**************@TK2MSFTNGP04.phx.gbl... >I have an Excel file save in the MyResource.resx. > I have to load the Excel file into strem. > I use the code: > ------------------------------------------------------------------------------------------ > ResourceManager a = new ResourceManager("WillNs.MyResource", > Assembly.GetExecutingAssembly()); > Stream myStream = a.GetStream("Empty.xls"); > ------------------------------------------------------------------------------------------ > But mySteam always reutn null. > > How can I do? > > >
Yes, it really do.
But I am confused.
What is the different between set added item embedded and add the item to
..resx?
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> ¼¶¼g©ó¶l¥ó·s»D:O3**************@TK2MSFTNGP03.phx.g bl... Hi,
An embedded resource is a file that is contained in the dll or exe assembly.
You do so by: 1- selecting add an existing item to a project 2- in the property tab of the added item , set Build Action to "Embedded resource"
then you can use the code I provided before
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"ad" <fl****@wfes.tcc.edu.tw> wrote in message news:e6**************@TK2MSFTNGP02.phx.gbl... What is Embedded resource. I added the file in a .resx file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> ¼¶¼g©ó¶l¥ó·s»D:uX**************@TK2MSFTNGP03.phx.g bl... Hi,
Do you mean that the only string you get is "WillNs.MyResource.resources"
Are you sure you included the file in the project and marked it as "Embedded resource" ? -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "ad" <fl****@wfes.tcc.edu.tw> wrote in message news:Oe**************@TK2MSFTNGP02.phx.gbl... I have do
foreach (string name in Assembly.GetExecutingAssembly().GetManifestResourc eNames()) Console.WriteLine(name);
but the name always is "WillNs.MyResource.resources"
I have put a Empty.xls in the WillNs.MyResource, but it still can't get the name of the file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> ¼¶¼g©ó¶l¥ó·s»D:ef**************@TK2MSFTNGP05.phx.g bl... > Hi, > > most probably the name is not correct, IIRC you have to use the > complete name, which is the name of the assembly + the name of the > file. > > do this > > foreach(string name in > Assembly.GetExecutingAssembly().GetManifiestResour ceNames() ) > Console.WriteLine( name); > > you will get all the names of the resources, later you can access the > correct one using > Assembly.GetExecutingAssembly().GetManifestResourc eStream( the_name); > > > -- > Ignacio Machin, > ignacio.machin AT dot.state.fl.us > Florida Department Of Transportation > > > > "ad" <fl****@wfes.tcc.edu.tw> wrote in message > news:Oq**************@TK2MSFTNGP04.phx.gbl... >>I have an Excel file save in the MyResource.resx. >> I have to load the Excel file into strem. >> I use the code: >> ------------------------------------------------------------------------------------------ >> ResourceManager a = new ResourceManager("WillNs.MyResource", >> Assembly.GetExecutingAssembly()); >> Stream myStream = a.GetStream("Empty.xls"); >> ------------------------------------------------------------------------------------------ >> But mySteam always reutn null. >> >> How can I do? >> >> >> > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Nils Erik Asmundvaag |
last post by:
Hello
I hope someone is able to help me with this frustrating problem.
I have a C# web project in Visual Studio .NET 2003. I want to support
Swedish and Norwegian texts and have put the texts...
|
by: Craig |
last post by:
Hi
I'm creating a web control whereby I use a resource file to store strings
for property descriptions and so forth.
The namespace for the control is: Unsd.Web.WebControls all classes in the...
|
by: the_medeiros |
last post by:
How i can use resources files to show display messages ???
I try use:
private static ResourceManager resourceManager = new
ResourceManager(typeof(ExceptionManager).Namespace +...
|
by: Weenie the Pooh |
last post by:
We are writing an ASP.Net C# application (VS 2003) and plan to use
embedded resources files for french, german and english UI.
I created resx files named _todo.resx and _todo.fr-CH.resx
Here...
|
by: Dennis |
last post by:
I have a .resx (xml) file that contains resources. I am trying to follow the
example in MSDN for creating the resource Manager as follows:
Dim myAssembly As System.Reflection.Assembly...
| |
by: Franz |
last post by:
I know how to use ResourceManager, but I think I don't use it wisely.
I have a web user control. Inside the control, I need to call
ResourceManager.GetString. However, I also need to call...
|
by: ad |
last post by:
We can get the string in Resource with ResourceManager like:
ResourceManager rm = new
ResourceManager(this.GetType().NameSpace+".Properties.Resources",
this.GetType().Assembly);
string...
|
by: Ryan Liu |
last post by:
Hi,
Why TcpClient has a method TcpClient.GetStream(), not just a read only
property?
By implementing it as a method, does that mean, each time GetStream() could
return a different stream? In...
|
by: ngrover |
last post by:
When accessing strings from a french language utf-8 .txt file (that has been resgen'ed into a .resources file) via ResourceManager.GetString() method, I am encountering a problem. All the special...
|
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,...
|
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...
| |
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: 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...
|
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...
|
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...
|
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 ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |