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.MyReso urce",
Assembly.GetExe cutingAssembly( ));
Stream myStream = a.GetStream("Em pty.xls");
------------------------------------------------------------------------------------------
But mySteam always reutn null.
How can I do? 7 11716
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.GetExe cutingAssembly( ).GetManifiestR esourceNames() )
Console.WriteLi ne( name);
you will get all the names of the resources, later you can access the
correct one using
Assembly.GetExe cutingAssembly( ).GetManifestRe sourceStream( the_name);
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:Oq******** ******@TK2MSFTN GP04.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.MyReso urce", Assembly.GetExe cutingAssembly( )); Stream myStream = a.GetStream("Em pty.xls"); ------------------------------------------------------------------------------------------ But mySteam always reutn null.
How can I do?
I have do
foreach (string name in
Assembly.GetExe cutingAssembly( ).GetManifestRe sourceNames())
Console.WriteLi ne(name);
but the name always is "WillNs.MyResou rce.resources"
I have put a Empty.xls in the WillNs.MyResour ce, but it still can't get the
name of the file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > ¼¶¼g©ó¶l¥ó·s»D: 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.GetExe cutingAssembly( ).GetManifiestR esourceNames() ) Console.WriteLi ne( name);
you will get all the names of the resources, later you can access the correct one using Assembly.GetExe cutingAssembly( ).GetManifestRe sourceStream( the_name);
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "ad" <fl****@wfes.tc c.edu.tw> wrote in message news:Oq******** ******@TK2MSFTN GP04.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.MyReso urce", Assembly.GetExe cutingAssembly( )); Stream myStream = a.GetStream("Em pty.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.mach in AT dot.state.fl.us > wrote
in message news:ef******** ******@TK2MSFTN GP05.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.GetExe cutingAssembly( ).GetManifiestR esourceNames() ) Console.WriteLi ne( name);
you will get all the names of the resources, later you can access the correct one using Assembly.GetExe cutingAssembly( ).GetManifestRe sourceStream( the_name);
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "ad" <fl****@wfes.tc c.edu.tw> wrote in message news:Oq******** ******@TK2MSFTN GP04.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.MyReso urce", Assembly.GetExe cutingAssembly( )); Stream myStream = a.GetStream("Em pty.xls"); ------------------------------------------------------------------------------------------ But mySteam always reutn null.
How can I do?
Hi,
Do you mean that the only string you get is "WillNs.MyResou rce.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.tc c.edu.tw> wrote in message
news:Oe******** ******@TK2MSFTN GP02.phx.gbl... I have do
foreach (string name in Assembly.GetExe cutingAssembly( ).GetManifestRe sourceNames()) Console.WriteLi ne(name);
but the name always is "WillNs.MyResou rce.resources"
I have put a Empty.xls in the WillNs.MyResour ce, but it still can't get the name of the file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > ¼¶¼g©ó¶l¥ó·s»D: 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.GetExe cutingAssembly( ).GetManifiestR esourceNames() ) Console.WriteLi ne( name);
you will get all the names of the resources, later you can access the correct one using Assembly.GetExe cutingAssembly( ).GetManifestRe sourceStream( the_name);
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "ad" <fl****@wfes.tc c.edu.tw> wrote in message news:Oq******** ******@TK2MSFTN GP04.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.MyReso urce", Assembly.GetExe cutingAssembly( )); Stream myStream = a.GetStream("Em pty.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.mach in AT dot.state.fl.us > ¼¶¼g©ó¶l¥ó·s»D: uX************* *@TK2MSFTNGP03. phx.gbl... Hi,
Do you mean that the only string you get is "WillNs.MyResou rce.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.tc c.edu.tw> wrote in message news:Oe******** ******@TK2MSFTN GP02.phx.gbl...I have do
foreach (string name in Assembly.GetExe cutingAssembly( ).GetManifestRe sourceNames()) Console.WriteLi ne(name);
but the name always is "WillNs.MyResou rce.resources"
I have put a Empty.xls in the WillNs.MyResour ce, but it still can't get the name of the file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > ¼¶¼g©ó¶l¥ó·s»D: 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.GetExe cutingAssembly( ).GetManifiestR esourceNames() ) Console.WriteLi ne( name);
you will get all the names of the resources, later you can access the correct one using Assembly.GetExe cutingAssembly( ).GetManifestRe sourceStream( the_name);
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "ad" <fl****@wfes.tc c.edu.tw> wrote in message news:Oq******** ******@TK2MSFTN GP04.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.MyReso urce", Assembly.GetExe cutingAssembly( )); Stream myStream = a.GetStream("Em pty.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.tc c.edu.tw> wrote in message
news:e6******** ******@TK2MSFTN GP02.phx.gbl... What is Embedded resource. I added the file in a .resx file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > ¼¶¼g©ó¶l¥ó·s»D: uX************* *@TK2MSFTNGP03. phx.gbl... Hi,
Do you mean that the only string you get is "WillNs.MyResou rce.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.tc c.edu.tw> wrote in message news:Oe******** ******@TK2MSFTN GP02.phx.gbl...I have do
foreach (string name in Assembly.GetExe cutingAssembly( ).GetManifestRe sourceNames()) Console.WriteLi ne(name);
but the name always is "WillNs.MyResou rce.resources"
I have put a Empty.xls in the WillNs.MyResour ce, but it still can't get the name of the file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > ¼¶¼g©ó¶l¥ó·s»D: 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.GetExe cutingAssembly( ).GetManifiestR esourceNames() ) Console.WriteLi ne( name);
you will get all the names of the resources, later you can access the correct one using Assembly.GetExe cutingAssembly( ).GetManifestRe sourceStream( the_name);
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "ad" <fl****@wfes.tc c.edu.tw> wrote in message news:Oq******** ******@TK2MSFTN GP04.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.MyReso urce", > Assembly.GetExe cutingAssembly( )); > Stream myStream = a.GetStream("Em pty.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.mach in AT dot.state.fl.us > ¼¶¼g©ó¶l¥ó·s»D: O3************* *@TK2MSFTNGP03. phx.gbl... 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.tc c.edu.tw> wrote in message news:e6******** ******@TK2MSFTN GP02.phx.gbl... What is Embedded resource. I added the file in a .resx file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > ¼¶¼g©ó¶l¥ó·s»D: uX************* *@TK2MSFTNGP03. phx.gbl... Hi,
Do you mean that the only string you get is "WillNs.MyResou rce.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.tc c.edu.tw> wrote in message news:Oe******** ******@TK2MSFTN GP02.phx.gbl... I have do
foreach (string name in Assembly.GetExe cutingAssembly( ).GetManifestRe sourceNames()) Console.WriteLi ne(name);
but the name always is "WillNs.MyResou rce.resources"
I have put a Empty.xls in the WillNs.MyResour ce, but it still can't get the name of the file.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > ¼¶¼g©ó¶l¥ó·s»D: 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.GetExe cutingAssembly( ).GetManifiestR esourceNames() ) > Console.WriteLi ne( name); > > you will get all the names of the resources, later you can access the > correct one using > Assembly.GetExe cutingAssembly( ).GetManifestRe sourceStream( the_name); > > > -- > Ignacio Machin, > ignacio.machin AT dot.state.fl.us > Florida Department Of Transportation > > > > "ad" <fl****@wfes.tc c.edu.tw> wrote in message > news:Oq******** ******@TK2MSFTN GP04.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.MyReso urce", >> Assembly.GetExe cutingAssembly( )); >> Stream myStream = a.GetStream("Em pty.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 in resource files
(.resx).
I build the project from the IDE without errors. A main assembly
(containing the Swedish texts) are created, and a resource assembly
|
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
control use this namespace. The assembly file name is
Unsd.Web.WebControls.Banner.dll and the resource file name which resides
in the same directory as the class files is Unsd.Web.WebControls.resources
(Build Action=Embedded Resource) 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 +
".ExceptionsPT",Assembly.GetAssembly(typeof(ExceptionManager)));
Thanks for any help or samples ... :)
--
|
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 is part of the code:
....
string txtReturn = "?";
ResourceManager locRM = new ResourceManager("myapp.resources._todo",
|
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
myAssembly = Me.GetType.Assembly
Dim myManager As New _
System.Resources.ResourceManager("ResourceNamespace.myResources", _
myAssembly
| |
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
ResourceManager.GetString for my web page body. Therefore, I need to create
2 ResourceManager instances in total. I think it is too big for putting
inside the Session.
I just want to know is there any practice for ResourceManager?
|
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 myString= rm.GetString("String1");
If I have make some change to myString, how can I write it back to the
String1 in Resource?
|
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 other words, is that safe I only call
GetStream() once and set it to a class' variable and reuse it later?
And sometime I see TcpClient.GetStream() throws
|
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 characters are not coming through. The accented vowels etc. are being stripped out.
Other non-latin languages are working just fine, the utf-8 encoding is not a problem for the ResourceManager.
any ideas?
utf example that i'm using:
...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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();...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |