How do I access resources in a console application?
Solution 1
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;
Solution 2
Your application does not appear to have any resources.
Joe
I play lots of games, develop a few. In my free time I've been working on a 1700s post-apocalyptic fantasy RPG setting, Signs in the Wilderness. Some of my published board/card games: Leaving Earth: The Space Race seen from the eyes of 1956. Victory through Industry: Industrial production on the home front of WWII. Vikings on the Volga: Trade and pillaging on the rivers of Russia. The Golden Wilderness: Early California, from the Spanish explorers to the Gold Rush. Connect with me on BoardGameGeek.
Updated on June 11, 2022Comments
-
Joe almost 2 years
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:
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