I have 2 listboxes on a form (Listbox1 and listbox2) and a vertical scrollbar. I'm sure this is simple, but i don't know how to do it. What i would like is for the one scroll bar to scroll both listboxes at the same time.
Get what i mean? :/
Printable View
I have 2 listboxes on a form (Listbox1 and listbox2) and a vertical scrollbar. I'm sure this is simple, but i don't know how to do it. What i would like is for the one scroll bar to scroll both listboxes at the same time.
Get what i mean? :/
use the listboxes .topindex property to scroll them in your vscroll_scroll event
I've never used that before so could you tell me what else to put after that?
I tried
vb Code:
ListBox1.TabIndex.ToString()
.tostring was in the 'common' so i just tried it and it didn't work, so i'm stuck.
you'll have to work out the vscrollbar.maximum value yourself. but the scrolling is something like this:
vb Code:
Private Sub VScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar1.Scroll ListBox1.TopIndex = VScrollBar1.Value ListBox2.TopIndex = VScrollBar1.Value End Sub
Thanks.