Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I access resources in a console application?

How do I gain access to .Properties.Resources in a console application? This is to use resource files attached to the solution.

Here's exactly what I can see: everything about the program

The first syntax error isn't the one I'm concerned with (Only assignment, call, increment, decrement, and new object expressions can be used as a statement).

The one that I'm trying to fix is the second: The name 'Properties' does not exist in the current context

like image 422
Joe Avatar asked Dec 21 '22 05:12

Joe


1 Answers

Edited answer (after your edit):

You don't have resources.

Right-Click on 'test' in Solution Explorer -> Add -> New Item -> Resources File

Then double-click on the created file (e.g. Resource1.resx), and take it from there.

Then use it:

string s = Resource1.String1;

Original answer:

Text = Properties.Resources.String1;

For example.

EDIT:

Click on the little triangle next to Properties in Solution Explorer, then do the same for Resources. Then double click Resources.Designer.cs.

Then copy the namespace there like this:

TheNameSpace.Properties.Resources.String1;
like image 105
ispiro Avatar answered Jan 05 '23 14:01

ispiro