471,570 Members | 1,711 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,570 software developers and data experts.

VS2005 C# and Resources

bob
Hi,
I am having trouble with Resources of a windows app.
If I understand correctly.
1) New C# Windows app. Namespace 'TestResources'
2) Edit default Resources file, set String1 value to say "MyApp"
3) Put the following code in ctor after InitializeComponent
ResourceManager rm = new ResourceManager("Resources",
Assembly.GetExecutingAssembly());

String s = rm.GetString("String1");///BREAKS HERE///

MessageBox.Show(s);

It breaks with a MissingManifestResourceException

Am I missing a setting ?

Thanks

Bob


Feb 18 '06 #1
2 1760
> Hi,
I am having trouble with Resources of a windows app.
If I understand correctly.
1) New C# Windows app. Namespace 'TestResources'
2) Edit default Resources file, set String1 value to say "MyApp"
3) Put the following code in ctor after InitializeComponent
ResourceManager rm = new ResourceManager("Resources",
Assembly.GetExecutingAssembly());
String s = rm.GetString("String1");///BREAKS HERE///

MessageBox.Show(s);

It breaks with a MissingManifestResourceException

Am I missing a setting ?

Thanks

Bob


VS2005 produces typesafe access to your resources, at least if you use the
default editors. Try Resources.String1.

--
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:la***@vkarlsen.no
PGP KeyID: 0x2A42A1C2
Feb 20 '06 #2
Bob
Hi,
Thanks ,
You put me on the right track.
Intellisense access to the default Resources is a fully formed name starting
at project Level.
(Project TestResources)
String s =TestResources.Properties.Resources.String1;
Is that little pearl of wisdom documented anywhere?
Are you told that you need "using TestResources.Properties" to make
reasonable use of the Resources object?
Nooo you are not.
Documentation in this area is inadequate in my opinion.

Thanks again for your help.
Bob

"Lasse Vågsæther Karlsen" <la***@vkarlsen.no> wrote in message
news:9d**************************@news.microsoft.c om...
Hi,
I am having trouble with Resources of a windows app.
If I understand correctly.
1) New C# Windows app. Namespace 'TestResources'
2) Edit default Resources file, set String1 value to say "MyApp"
3) Put the following code in ctor after InitializeComponent
ResourceManager rm = new ResourceManager("Resources",
Assembly.GetExecutingAssembly());
String s = rm.GetString("String1");///BREAKS HERE///

MessageBox.Show(s);

It breaks with a MissingManifestResourceException

Am I missing a setting ?

Thanks

Bob


VS2005 produces typesafe access to your resources, at least if you use the
default editors. Try Resources.String1.

--
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:la***@vkarlsen.no
PGP KeyID: 0x2A42A1C2

Feb 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Rob Dob | last post: by
3 posts views Thread by musosdev | last post: by
11 posts views Thread by CMM | last post: by
1 post views Thread by Bob | last post: by
5 posts views Thread by Terry Jolly | last post: by
3 posts views Thread by clintonG | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by lumer26 | last post: by

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.