Horizontal Scrollbar is not visible on DataGridView

68,583

Solution 1

Well Guys, its sorted out.

I am answering my own question; it may help someone in future.

one of the columns has Frozen property set as True. which should be false for all columns. Now ScrollBar is working absolutely fine for me.

Cheers

enter image description here

Solution 2

I know this has already been resolved, but I've come across another reason why this could happen, so thought I'd add it as an answer in case someone else has the same problem.

If your form has a DataGridView that is docked to fill the form, and the form also has a status bar, then depending on the order they're created, the status bar can hide the DataGridView's scrollbar. To fix this, right click on the DataGridView, and select "Bring to Front".

Solution 3

When I encountered this annoying problem, it was due to the AutoSizeColumnsMode property of the DGV that was set to Fill

I fixed it by changing that property to AllCells, but any other value will work. It works even if the DGV is docked and I have multiple docked panels, and the first column is Frozen.

Solution 4

The docking.Fill of the DGV is a little buggy.
It happens when you have multiple docked panels, toolbars, etc. More common when you're creating your columns at runtime.

The control thinks it is wider than its container and the Horizontal scrollbar does not spawn.

Frozen, autosize, brint to front and the other remedies mentioned don't always work. The most reliable workaround is to Dock.Left and set the DGV's width at run time. This way the DGV doesn't get confused about how wide it is.

Solution 5

i had the similar problem. What I did was, check each of your Datagrid columns and set the Frozen to "false". Hope that helps.

Share:
68,583
Scorpion
Author by

Scorpion

MCP, MCTS

Updated on June 17, 2020

Comments

  • Scorpion
    Scorpion almost 4 years

    I have a DataGridView on Window form which is populated with 30 columns and thousands of rows. ScrollBars property is set to Both, but still horizontal scroll bar is not visible. even I am unable to scroll with arrow key from keyboard.

    I tried it by setting ScrollBars property to Horizontal as well, but that does not make any difference.

    Any suggestions please?

    Thanks

  • Cyril Gandon
    Cyril Gandon almost 11 years
    Awesome, all my columns was set to frozen, that's why the scrollbar didn't show. I would never think of that, ty!
  • Scorpion
    Scorpion almost 11 years
    @Scorpi0 Glad, It helped you :)
  • CODe
    CODe over 10 years
    Who knew. This answer saved me since I just so happened to be using a status bar on the bottom of my form. "Bring to Front" solved my problem and started showing my horizontal scroll on my datagridview. Thanks!
  • DontFretBrett
    DontFretBrett over 10 years
    All mine are set to frozen and I still have the problem :/
  • Scorpion
    Scorpion over 10 years
    @DontFretBrett try to set of Frozen = False.
  • TaW
    TaW over 9 years
    To add; Only the leftmost columns may be frozen if you want scrollbars to appear. Also, at least a part of the first not-frozen column must be visible.
  • mkluwe
    mkluwe about 8 years
    Just stumbled upon the same problem after copying example code from MSDN online docs.
  • RBT
    RBT almost 8 years
    For me it was simply not visible because I had set the height of the data grid view to a value that it was crossing the height boundary of its container control.
  • Ricky Stam
    Ricky Stam over 7 years
    For me the problem was that i had a column with AutoSizeMode property to Fill, i changed it to DisplayedCells and worked fine.
  • braX
    braX over 6 years
    This was exactly my problem and now it's fixed. Not sure why it's down-voted.
  • gumuruh
    gumuruh about 6 years
    that's true! 100% for me as well here using VS2013 under win7. Thanks @Dan .
  • Ananda Prasad Bandaru
    Ananda Prasad Bandaru almost 6 years
    If all are frozen then it would not work. At least the last columns needs to have Frozen=false
  • NadimAJ
    NadimAJ over 3 years
    I found every time I copied and pasted the dgv from another tab, it would somehow manage to change the size of my dgv's elsewhere (raising the y by around 10 points) and ultimately hiding the scrollbars from view
  • Jonathan Monestel
    Jonathan Monestel about 3 years
    I'll be da**ed. That was my issue, right before presenting the data. My issue was the DGV was updated and the scrollbar appeared half way in. You could see there was a scrollbar but the actual bar did not show. Adding that command right before presenting the data fixed my issue.