8
votes

The DataGridView (Form) holds enough rows that the vertical Scrollbar is shown. But its not enabled. The Silder for Movement is missing and the Button Up and Button Down are greyed out.

=> there is a vertical scrollbar but not enabled.

I tried:

  1. After filling the DataGridView the control is updated.
  2. Resizing the entire Panel.
  3. The Frozen attribute is false.
  4. I a click in a cell i can use the up and down keys to scroll, but the scrollbar will not be enabled.

If I resize the Control while running (DataGridView is on a Splitpanel) the Scrollbar can be used e.g its now enabled.

5
if you are talking about rows, and button up and down, then I think you may be looking for the VerticalScrollbar - paul
The problem is ->not<- the visibilty of the vertical scrollbar - Thomas
You tried to set the width property to a smaller value? - lolo

5 Answers

7
votes

Try this:

1. One of your columns has probably frozen property set as True.

which should be False for all columns.

2. Set the AutoSizeMode of the problematic column to AllCells

3. mygrid.DockStyle = DockStyle.Fill

1
votes

Set ScrollBar property of datagridview is Both.

1
votes

The same problem plus some workarounds can be found here: DataGridView vertical scrollbar not updating properly (Forms bug?)
It definitely seems to be a winforms bug that appears, e.g. when a DGV is placed inside a tab of a tabcontrol.

1
votes
  1. You should dock fill your datagridview to panel
  2. If you have some frozen rows, make sure these rows are set after you finish bringing data to your gridview

If you set the frozen row before, the row when added will take the default style of the first row, and all your gridview rows will have the option row.frozen = true. That's why the vertical scroll won't appear.

0
votes

I had a similar issue with the horizontal scroll bar. Doing PerformLayout on the grid didn't solve it. It turns out that the problem in my case was that the form was disabled. We have an infrastructure that disables the form on load, loads a bunch of stuff asynchronously and at the end enables the form. For some reason this was enough for the scroll bar to stay disabled when the form was enabled (and like in your scenario resizing the form while running enabled the scroll bar). So for me the solution was calling PerformLayout on the grid after enabling the form.