We help IT Professionals succeed at work.

How to control how the slider bar applied the commands

eneate asked
Medium Priority
Last Modified: 2010-04-07

I am adding a slider bar to an application. Is there a way that I can tell when the value has changed and exh time it changes it undoes the last function and applies the new one. The code I am using looks like this
Dim text1 As String
Dim text2 As String
Dim title2 As String * 13
Dim sliderval As Integer

ret = IpDocGetStr(INF_NAME, DOCSEL_ACTIVE, title)
 text1 = title
 text2 = orig

If text1 = text2 Then
sliderval = Guihigh.Slider1.Value

ret = IpWsOverlay(overlay, sliderval, 0)

I need the slider val to be one function between two images at the moment it changes each time it is moved but then keeps applying the function rather than just changing it.
Any help appreciated.
Watch Question

Not exactly sure what you mean, but assuming you are using the Microsoft Common Controls
(from components->Microsoft Common Controls, i.e., MSCOMCTL.OCX)

then the Slider1_mouseMove event is called any time the slider is moved.

So if I understand what you are asking, -- you are saying -- if the slider changes value (i.e.,
from 10 to 11), then you want to call a function to do something. If that is the case, then you
would do this. Add a textbox, and a slider to your form. Then add this code:

Dim previousSlideValue as Integer

Private Sub Form_Load()
previousSlideValue = -1
end sub

Private Sub Slider1_MouseMove(Button as Integer, Shift as Integer, x as Single, y as Single)
  if previousSlideValue <> slider1.value then
     previousSlideValue = slider1.value
     ' CALL YOUR FUNCTION HERE! I.E., displaying a value in a textbox!
     text1.text = slider1.value
  end if

End Sub

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts



Thanks for the feedback. It 's all now working fine and you gave me some new ideas.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.