Hi,
A very crude example illustrating how you can simply multiply/divide by 10^NumberOfDecimals (in your case 10, in my example 100 for 2 decimals) to implement decimals:
form code
------------------------------------------------------
Dim MyScrollBar As New DecimalScrollBar()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Controls.Add(MyScrollBar)
MyScrollBar.DecimalMaximum = 100
MyScrollBar.DecimalValue = 3.45
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
MessageBox.Show(MyScrollBar.DecimalValue.ToString)
End Sub
------------------------------------------------------
New scrollbar class
------------------------------------------------------
Public Class DecimalScrollBar
Inherits HScrollBar
Const DecFact As Int32 = 100
Public Property DecimalValue() As Single
Get
DecimalValue = Convert.ToSingle(MyBase.Value / DecFact)
End Get
Set(ByVal Value As Single)
MyBase.Value = Convert.ToInt32(Value * DecFact)
End Set
End Property
Public Property DecimalMaximum() As Single
Get
DecimalMaximum = Convert.ToSingle(MyBase.Maximum / DecFact)
End Get
Set(ByVal Value As Single)
MyBase.Maximum = Convert.ToInt32(Value * DecFact)
End Set
End Property
End Class
------------------------------------------------------
You should add error handling, change the DecFact constant to a property with an initial value etc.
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'