Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

knobs, sliders float to integer

I am a newbie and trying to find out how to set the knob or slider to give out only integer outputs in Measurement studio
0 Kudos
Message 1 of 2
(5,859 Views)
There is not a way to change the return type of the Value property, but you can configure the knob so that it snaps to whole intervals, and then you can convert the value to an integer. If you're using the Measurement Studio 7.1 .NET Windows Forms controls in VB.NET, you can go to the Properties window and set CoercionMode to ToInterval, CoercionIntervalBase to 0, and CoercionInterval to 1. You can also do this programmatically:

With knob
.CoercionMode = NumericCoercionMode.ToInterval
.CoercionIntervalBase = 0
.CoercionInterval = 1
End With

If you're using the CWKnob ActiveX control in VB6, you can go to the Numeric tab in the property pages, check Discrete in the Values group and set DiscreteBase to 0 and DiscreteInterval to 1. You can
also do this programmatically:

With knob.Axis
.Discrete = True
.DiscreteBase = 0
.DiscreteInterval = 1
End With

You can then use VB's CInt function to convert the value to an integer:

Dim value as Integer
value = CInt(knob.Value)

- Elton
0 Kudos
Message 2 of 2
(5,859 Views)