From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Example using CaptionSource_MacroExpression anywhere?

Solved!
Go to solution

I'm using C# to develop a custom user interface and I'm trying to figure out how to pass a format expression (ie. "%ProgressTextLongName% %ProgressPercentLongName%") to the CaptionSources.CaptionSource_MacroExpression using

AxExecutionViewMgr's ConnectCaption() method and CaptionConnection's FormatExpression property. I'm using the following code to do so:

 

CaptionConnection cc = axExecutionViewMgr.ConnectCaption(axLabel2, CaptionSources.CaptionSource_MacroExpression, true);
cc.FormatExpression = "%ProgressTextLongName% %ProgressPercentLongName%";

 

But all the label says is "The expression cannot be empty". It says this even though I perform an execution of a sequence. Are there any examples that show how to use this macro expression anywhere?

0 Kudos
Message 1 of 3
(3,264 Views)
Solution
Accepted by topic author MSumulong

Just a guess, but since it is an expression, it probably needs quotes to make it a valid string expression:

 

cc.FormatExpression = "\"%ProgressTextLongName% %ProgressPercentLongName%\'";

0 Kudos
Message 2 of 3
(3,262 Views)

That worked! Thanks!

0 Kudos
Message 3 of 3
(3,237 Views)