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. C#
  4. Datagrid in Winform

Datagrid in Winform

Scheduled Pinned Locked Moved C#
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.
  • C Offline
    C Offline
    Chris 3
    wrote on last edited by
    #1

    I have a datagrid showing 200+ records, if user scrolls down to select a row that is off the initail screen, can I set the datagrid to show that part of data around the selected row to avoid user using scroll bar again and again. Thanks,

    D C 2 Replies Last reply
    0
    • C Chris 3

      I have a datagrid showing 200+ records, if user scrolls down to select a row that is off the initail screen, can I set the datagrid to show that part of data around the selected row to avoid user using scroll bar again and again. Thanks,

      D Offline
      D Offline
      Daniel Zaharia
      wrote on last edited by
      #2

      If I understood well, you want to be able to scroll the DataGrid to a certain position. DataGrid has some protected members that you can use to handle scrolling: VertScrollBar, HorizScrollBar, GridVScrolled, GridHScrolled. For vertical scrolling I recommend you to do something like this: public class MyDataGrid:DataGrid { public void ScrollToPos(int position) { ScrollEventArgs sea= new crollEventArgs(ScrollEventType.ThumbPosition,position); this.GridVScrolled(this,sea); } } Best Regards, Daniel Zaharia

      1 Reply Last reply
      0
      • C Chris 3

        I have a datagrid showing 200+ records, if user scrolls down to select a row that is off the initail screen, can I set the datagrid to show that part of data around the selected row to avoid user using scroll bar again and again. Thanks,

        C Offline
        C Offline
        Chris 3
        wrote on last edited by
        #3

        Thanks a lot, your method is working fine. I just put the row index as the position parameter. Appreciate!!!

        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