Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. DataGridView Scrolling

DataGridView Scrolling

Scheduled Pinned Locked Moved Visual Basic
help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Are Jay
    wrote on last edited by
    #1

    I have 2 DataGridView and I need them to scroll together. The first DataGridView has Scrollbars set to none and the second DataGridView is only displaying the Vertical scrollbar. I need the Sync. the second DataGridView's vertical scrollbar to move the first DataGridView's vertical position. Private Sub _Scrolling(ByVal sender As Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Dim g As DataGridView = CType(Me.MainTabControl.Controls.Find("Employee_times", True)(0), DataGridView) ' need help tranfering the event to the first DataGridView End Sub Thanks.

    D 1 Reply Last reply
    0
    • A Are Jay

      I have 2 DataGridView and I need them to scroll together. The first DataGridView has Scrollbars set to none and the second DataGridView is only displaying the Vertical scrollbar. I need the Sync. the second DataGridView's vertical scrollbar to move the first DataGridView's vertical position. Private Sub _Scrolling(ByVal sender As Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Dim g As DataGridView = CType(Me.MainTabControl.Controls.Find("Employee_times", True)(0), DataGridView) ' need help tranfering the event to the first DataGridView End Sub Thanks.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Well, there's an easy way and a hard way. We'll try the easy way first: The easy way is to put both DGV's in a Panel control and turn scrolling on in the panel. Don't turn on scrolling in the DGV's and don't worry about how big they DGV get. Just let them grow as far as they want in the vertical direction. The panel will then take care of the scrolling for you.

      Dave Kreskowiak Microsoft MVP - Visual Basic

      A 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Well, there's an easy way and a hard way. We'll try the easy way first: The easy way is to put both DGV's in a Panel control and turn scrolling on in the panel. Don't turn on scrolling in the DGV's and don't worry about how big they DGV get. Just let them grow as far as they want in the vertical direction. The panel will then take care of the scrolling for you.

        Dave Kreskowiak Microsoft MVP - Visual Basic

        A Offline
        A Offline
        Are Jay
        wrote on last edited by
        #3

        How simple was that. LOL I ended up with a work around using the.. gTime.SetBounds(0, (-gEmployee.VerticalScrollingOffset) + 11, gTime.Size.Width, gTime.Size.Height) Thanks for the help. I've been wanting to contribute to the site with an article of some sort. So, I'm thinking of using parts of my current project with the multiple datagridviews and runtime creation of them and linking. As my first attempt at an article on the site. Thanks again.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups