468,290 Members | 1,978 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,290 developers. It's quick & easy.

"string resource file" in c#?

Hello,
What is the equivalent "string resource file" in c#?

And, is there a way to create a beep in C#?

Thanks,
Dan
Nov 15 '05 #1
7 6641
100
Hi Dan,
What is the equivalent "string resource file" in c#?
I don't think there is equivalent of string resource since you can embed
whatever stream you want into a assembly. My suggestion is to use XML file
for keeping the strings. If you need language specific versions of the
strings you can use satellite assemblies, which will contain different
versions of that xml file.
And, is there a way to create a beep in C#?

There is no class in the current vesrion of the framework providing this.
You have to use P\Invike to call MessageBeep or whatever other API function
you want. If search the net I believe there are tons of examples how to do
beeps.

HTH
B\rgds
100
Nov 15 '05 #2
Hi Dan,

If your purpose is internationalization and localization, with .NET,
Microsoft (finally) provides truely excellent support. (Even if you want a
string resource for some other reason, these features will do the trick for
you.) Take a look at the Localizable property on the Form properties
window. Turn it on and all form and control properties will be stored in a
separate resources file. Take a look at the InitializeComponent() code to
see how it works. In addition, Microsoft provides a WinRes.exe resource
editor that lets localizers edit these properties without having access to
the code. Since the resource is an XML file (e.g. Form1.resx file) you can
use any XML editor to modify its contents if you'd like.

In addition, .NET supports the creation of multiple resource files using a
hierarchical model. There is a basic invarient resource, then ones that are
language specific, then ones that are dialect specific and so forth. All of
this is supported in the default Form, so you can explore these features in
the Form properties. For example, try setting the Language to French and
see what happens.

Tom Clement
Apptero, Inc.

"Dan H." <Da********@NO.comcast.SsPpAaMm.net> wrote in message
news:uU**************@TK2MSFTNGP10.phx.gbl...
Hello,
What is the equivalent "string resource file" in c#?

And, is there a way to create a beep in C#?

Thanks,
Dan

Nov 15 '05 #3
> What is the equivalent "string resource file" in c#?
Yes.
The .NET string resource file looks like the Java properties
(id=string), but the encoding uses UTF8 instead of Java escape.

The extension is .txt (I think a bad idea), and can be compiled
with ResGen to a .resources file
You can also use .resx files (xml format)
ResGen is able to convert between .resx, .txt and .resources
(but if the resx contain forms, images, etc, it will drop them)

Mihai
Nov 15 '05 #4

"Dan H." <Da********@NO.comcast.SsPpAaMm.net> 在郵件
news:uU**************@TK2MSFTNGP10.phx.gbl 中撰寫...
Hello,
What is the equivalent "string resource file" in c#?

If the purpose is for Localization, simply set your form's Localizable
property to true and then change the Language property to whatever language
you want and start changing the control's text. The locailization
information will be stored in the language specific resx files.
And, is there a way to create a beep in C#?

Include the following in your class file to 'Beep'

[System.Runtime.InteropServices.DllImport("user32.d ll")]
public static extern int MessageBeep(uint n);
Thanks,
Dan

Nov 15 '05 #5
Joe
Is any of this possible (reasonably easily :-)) without VS.Net? I am
using SharpDevelop 0.98 (free VS.Net lookalike), and trying to get
something working similar to what is in VS.Net. Ya, I know, just buy
VS.Net :-) But I am cheap.

It seems like what I need is basically a resource editor that
generates .resx files (including stuff like size of Dialog boxes,
etc), but am still naive about how all this resource stuff works.

Any one have any experience with this?

Thanks,

Joe

"Terence Lee" <tc****@netvigator.com> wrote in message news:<ef*************@tk2msftngp13.phx.gbl>...
"Dan H." <Da********@NO.comcast.SsPpAaMm.net> 在郵件
news:uU**************@TK2MSFTNGP10.phx.gbl 中撰寫...
Hello,
What is the equivalent "string resource file" in c#?


If the purpose is for Localization, simply set your form's Localizable
property to true and then change the Language property to whatever language
you want and start changing the control's text. The locailization
information will be stored in the language specific resx files.

Nov 15 '05 #6
Joe
Is any of this possible (reasonably easily :-)) without VS.Net? I am
using SharpDevelop 0.98 (free VS.Net lookalike), and trying to get
something working similar to what is in VS.Net. Ya, I know, just buy
VS.Net :-) But I am cheap.

It seems like what I need is basically a resource editor that
generates .resx files (including stuff like size of Dialog boxes,
etc), but am still naive about how all this resource stuff works.

Any one have any experience with this?

Thanks,

Joe

"Terence Lee" <tc****@netvigator.com> wrote in message news:<ef*************@tk2msftngp13.phx.gbl>...
"Dan H." <Da********@NO.comcast.SsPpAaMm.net> 在郵件
news:uU**************@TK2MSFTNGP10.phx.gbl 中撰寫...
Hello,
What is the equivalent "string resource file" in c#?


If the purpose is for Localization, simply set your form's Localizable
property to true and then change the Language property to whatever language
you want and start changing the control's text. The locailization
information will be stored in the language specific resx files.

Nov 15 '05 #7
SharpDevelop makes the full framework available to you.

To generate .resx files, use code something like this:

ResXResourceWriter rw = new
ResXResourceWriter(@"C:\myFullPathAndFileName + ".resx");
rw.AddResource("Key", value);
//add more key/value pairs, etc.
rw.Generate();
rw.Close();

you need a using statement like:
using System.Resources;

and you need to ref the WinForms DLL
"Joe" <jw******@hotmail.com> wrote in message
news:6f**************************@posting.google.c om...
Is any of this possible (reasonably easily :-)) without VS.Net? I am
using SharpDevelop 0.98 (free VS.Net lookalike), and trying to get
something working similar to what is in VS.Net. Ya, I know, just buy
VS.Net :-) But I am cheap.

It seems like what I need is basically a resource editor that
generates .resx files (including stuff like size of Dialog boxes,
etc), but am still naive about how all this resource stuff works.

Any one have any experience with this?

Thanks,

Joe

"Terence Lee" <tc****@netvigator.com> wrote in message

news:<ef*************@tk2msftngp13.phx.gbl>...
"Dan H." <Da********@NO.comcast.SsPpAaMm.net> 在郵件
news:uU**************@TK2MSFTNGP10.phx.gbl 中撰寫...
Hello,
What is the equivalent "string resource file" in c#?


If the purpose is for Localization, simply set your form's Localizable
property to true and then change the Language property to whatever language you want and start changing the control's text. The locailization
information will be stored in the language specific resx files.

Nov 15 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by John Pastrovick | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.