By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,057 Members | 1,249 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,057 IT Pros & Developers. It's quick & easy.

Resource File

P: n/a
Hi I am a newbie and i am trying to create a resource file (resx) for a
console C# application
Can i go to current C# project and add a new resource file and then
start adding values?

Can anyone please show a sample console application having a resource
file added like this.

Help would be appreciated

Regards
JK

Sep 28 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,
You could easily create a new project and add it. if you get an error then
you cannot if you don't well then you can have resources in console apps.

In the later case it will be accesable using the same code than from a win
or any other type of project
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"gopal" <go*********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Hi I am a newbie and i am trying to create a resource file (resx) for a
console C# application
Can i go to current C# project and add a new resource file and then
start adding values?

Can anyone please show a sample console application having a resource
file added like this.

Help would be appreciated

Regards
JK

Sep 28 '06 #2

P: n/a

gopal wrote:
Hi I am a newbie and i am trying to create a resource file (resx) for a
console C# application
Can i go to current C# project and add a new resource file and then
start adding values?

Can anyone please show a sample console application having a resource
file added like this.

Help would be appreciated

Regards
JK
Add a resource file via Project -Add New Item -Assembly Resource
File

Add items to your resource file.

Example code to get a resource with a "name" of "Res1" from a resource
file:

using System;

namespace ConsoleApplication1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
System.Resources.ResourceManager rm = new
System.Resources.ResourceManager ("ConsoleApplication1.Resource1",
System.Reflection.Assembly.GetExecutingAssembly()) ;
Console.WriteLine (rm.GetString ("Res1"));
Console.ReadLine ();
}
}
}

best

Nick
http://seecharp.blogspot.com/

Sep 28 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.