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