spinbutton


Posted by steve on March 31, 2001 8:53 AM

I have a spinbutton linked to a text box and I can have it scroll through numbers fine. What I want is to have it scroll through percentages (1%-10%). Just to let you know its on a user form that I use to muiltiply different ranges by a percentage more.

Thanks steve



Posted by Dave Hawley on March 31, 2001 6:40 PM

Hi Steve

In The Properties window:
Set the Min Value of the Spinbutton to 0
Set the Max Value of the Spinbutton to 10
Set the Value of the TextBox to 0

Then use this:

Private Sub SpinButton1_SpinDown()
TextBox1.Value = Format(0, "0.0")
TextBox1.Value = TextBox1.Value + SpinButton1.Value / 100
TextBox1.Value = Format(TextBox1.Value, "0.0%")
End Sub

Private Sub SpinButton1_SpinUp()
TextBox1.Value = Format(0, "0.0")
TextBox1.Value = TextBox1.Value + SpinButton1.Value / 100
TextBox1.Value = Format(TextBox1.Value, "0.0%")
End Sub

Dave

OzGrid Business Applications