04-07-2015 03:25 AM
There is something weird happening: I put NumericTextBoxDouble at form, set its value to 0, and it shows -0. It obviously should be 0.
Measurement Studio 2013 / VS 2010/2013
Solved! Go to Solution.
04-07-2015 07:23 AM
Trying to run your example on my machine results in an upgrade of the NationalInstruments.Common library from version 13.5.40.173 to 13.5.40.190.
Regardless if i update the project or not, i cannot reproduce the issue you describe. I am pretty sure that the project uses the .190 version in any case as the .173 isn't installed on my machine.
Did you run the update service on your MStudio installation?
Norbert
04-07-2015 08:45 AM
This is a known issue with an update made to a Measurement Studio dependency that was shipped in a recent driver release. This has been fixed internally, and should be available soon.
Until that fix is available, as a workaround you can use a custom value formatter to wrap the existing formatter and correct the incorrect negative zero display:
numericTextBox.ValueFormatter = new NegativeZeroCorrection( );
...
public sealed class NegativeZeroCorrection : ValueFormatter {
private readonly ValueFormatter _inner;
public NegativeZeroCorrection( ValueFormatter inner = null ) {
_inner = inner ?? new GeneralValueFormatter();
}
protected override string FormatCore<TData>( TData value, ValuePresenterArgs args ) {
string result = _inner.Format<TData>( value, args );
if( result == "-0" )
result = "0";
return result;
}
public override TData Parse<TData>( string value, ValuePresenterArgs args ) {
return _inner.Parse<TData>( value, args );
}
public override bool TryParse<TData>( string value, ValuePresenterArgs args, out TData parsedValue ) {
return _inner.TryParse<TData>( value, args, out parsedValue );
}
protected override Freezable CreateInstanceCore( ) {
return new NegativeZeroCorrection( );
}
}
08-11-2015 01:22 PM
Just wanted to let you know this issue (#519251) was fixed in the Measurement Studio 2015 release.