DataGridView Vertical Scroll is disabled. RRS feed

  • Question

  • Hi,

    I am binding datagridview with List the list data is populating correctly but the vertical scroll bar is disabled but it is visible. How can I make enable the veritical scroll bar for this datagridview?

    Friday, June 18, 2010 8:15 PM


All replies

  • Hi Malikz,

    scrollbar is disabled if the DataGridView is disabled ... Check the Enabled property on your DataGridView. If you want to restrict user's editing actions in the grid you can use ReadOnly property on the DataGridView and set it to true. You can also do this per column. ReadOnly will still allow user to move through the grid cells and scroll the content.

    Nothing else comes to mind at the moment ... if I missed the root cause of your problem please post the code where you set up your DataGridView, from both the designer  (InitilaizeComponent method) and from code - if you do that. 

    Hope this helps,
    best regards,

    Saturday, June 19, 2010 10:47 AM
  • Hi Malikz,

    When did this happen? Usually DataGridView inside a TabControl this problem did manifest, or you first bind it to the source, and then modify the source and binding it again.

    Anyway, the workaround is do as follows:(suppose you already have set the ScrollBars property of the DataGridView to Both or Vertical)

    First, make sure your DataGridView1.Enabled is true.
            dataGridView1.Controls[0].Enabled = true; // Index zero is the horizontal scrollbar
            dataGridView1.Controls[1].Enabled = true; // Index one is the vertical scrollbar

    Useful links:


    Best Wishes,
    Helen Zhou

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by Helen Zhou Friday, June 25, 2010 2:43 AM
    Wednesday, June 23, 2010 8:48 AM