noob needing help with VB

Associate
Joined
31 Jul 2008
Posts
1,328
Location
London
I just started learning vb 2008 and i've been trying to get two HScrollBar moving together in sync.

So if i move the top HScroll bar the bottom will move aswell and i just can't seem to get it to work

any help would be great

Code:
Public Class Form1

    Private Sub hsbPound_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles hsbPound.Scroll
        txtPound.Text = hsbPound.Value
    End Sub

    Private Sub hsbDollar_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles hsbDollar.Scroll
        hsbDollar.Value = hsbPound.Value + 1
        txtDollar.Text = hsbDollar.Value
    End Sub
End Class
 
Try this:

Code:
Public Class Form1

    Private Sub hsbPound_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles hsbPound.Scroll
        txtPound.Text = hsbPound.Value
        hsbDollar.Value = hsbPound.Value
    End Sub

    Private Sub hsbDollar_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles hsbDollar.Scroll
        txtDollar.Text = hsbDollar.Value + 1
        hsbDollar.Value = hsbPound.Value
    End Sub
End Class

Not sure if this is what you need, but it should make the other scroll bar change value when either scroll bar is moved
 
Try this:

Code:
Public Class Form1

    Private Sub hsbPound_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles hsbPound.Scroll
        txtPound.Text = hsbPound.Value
        hsbDollar.Value = hsbPound.Value
    End Sub

    Private Sub hsbDollar_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles hsbDollar.Scroll
        txtDollar.Text = hsbDollar.Value + 1
        hsbDollar.Value = hsbPound.Value
    End Sub
End Class

Not sure if this is what you need, but it should make the other scroll bar change value when either scroll bar is moved

thanks a lot ArtificialFoxx they helped me a lot:D
 
Back
Top Bottom