Hi, thanks for the reply!
But I mean, how can i use a string variable in the method that gets values
from a specified .settings file.
On load, the user selects which track he wants, if he selects track 2, then
the method will look like this: ...properties.Track2.Default.THEVALUE, and on
track 1 like this: properties.Track1.Default.THEVALUE.
It's the "string" Track1 and Track2 i want to replace with a variable that
is selected from the user.
Thank you :)
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,
You will have to either wrap the class or use a third property
class ABC
{
public static int MyInt;
public static string GetValue{ get{ if (MyInt == 1 ) return "track 1"; else
return "track2"; } }
}
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Svein Erik" <Sv*******@discussions.microsoft.comwrote in message
news:C7**********************************@microsof t.com...
"Michael C" wrote:
"Svein Erik" <Sv*******@discussions.microsoft.comwrote in message
news:27**********************************@microsof t.com...
This is a C# 2005 project:
I'm struggling to figure how to make a variable accessible and
changeable
in
several forms in a windows application..
It's only a int variable which is set when the program loads, and this
must
be accessible from any form within the application, and I also need to
be
able to change it from any form.
Any hints or samples on how I can do this?
Put this int in any class like this
class ABC
{
public static int MyInt;
}
then use it like this
ABC.MyInt = 5;
You can also create property set and get for it if you like.
Thanks!
Svein Erik
Thanks!
I went for the property set, and it works like a charm :)
But now i stumbled upon the next problem:
When i have 2 property sets; Track1 and Track2. How can i use the track
that
the user selects on load?
If the user selects Track2, properties for Track2 is to be loaded:
....properties.Track2.Default....
How can I set the Track2 text manually?
Thank you!