NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

set global variable with c#

HI,
i am trying to write a c# programm that set a global variable. The problem is that it doesn't walk everytime. sometime it walks, sometime not.I can always read the current value, but it is not always possible to change it.
 i don't know what i'm doing wrong. hier ist the Code:
 

IEngine

IEngineObj=null;

PropertyObject PObj=null;

IEngineObj =

new Engine();

PObj=IEngineObj.Globals;

if ( PObj.GetValBoolean("Config.UseConfig", PropertyOptions.PropOption_NoOptions))

PObj.SetValBoolean("Config.UseConfig", 0, false);

 else

PObj.SetValBoolean(

"Config.UseConfig", 0, true);

PObj =

null;

IEngineObj =

null;

Teststand 3.5
Visual Studio 2005
0 Kudos
Message 1 of 3
(3,848 Views)
Hi,
 
You dont trap for any error conditions!
Does "Config.UseConfig" exist all the time? If not check for its existence and if it doesn't exist use 

PObj.SetValBoolean("Config.UseConfig", 1, true); with the options set to 1.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 3
(3,829 Views)

HI Ray,

"Config.UseConfig" always exist. with the option set to 1, the problem can't be solved. i tryed it without success.

Regards,

Noubissi

Teststand 3.5
Visual Studio 2005
0 Kudos
Message 3 of 3
(3,799 Views)