Results 1 to 5 of 5

Thread: [RESOLVED] [2008] Listboxes scrolling together

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2008
    Location
    Altoona, PA
    Posts
    242

    Resolved [RESOLVED] [2008] Listboxes scrolling together

    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? :/

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: [2008] Listboxes scrolling together

    use the listboxes .topindex property to scroll them in your vscroll_scroll event

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2008
    Location
    Altoona, PA
    Posts
    242

    Re: [2008] Listboxes scrolling together

    I've never used that before so could you tell me what else to put after that?

    I tried

    vb Code:
    1. ListBox1.TabIndex.ToString()

    .tostring was in the 'common' so i just tried it and it didn't work, so i'm stuck.

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: [2008] Listboxes scrolling together

    you'll have to work out the vscrollbar.maximum value yourself. but the scrolling is something like this:

    vb Code:
    1. Private Sub VScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar1.Scroll
    2.     ListBox1.TopIndex = VScrollBar1.Value
    3.     ListBox2.TopIndex = VScrollBar1.Value
    4. End Sub

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2008
    Location
    Altoona, PA
    Posts
    242

    Re: [2008] Listboxes scrolling together

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width