Horizontal Scrollbar is not visible on DataGridView
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
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.
Comments
-
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 toBoth
, 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 toHorizontal
as well, but that does not make any difference.Any suggestions please?
Thanks
-
Cyril Gandon almost 11 yearsAwesome, all my columns was set to frozen, that's why the scrollbar didn't show. I would never think of that, ty!
-
Scorpion almost 11 years@Scorpi0 Glad, It helped you :)
-
CODe over 10 yearsWho 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 over 10 yearsAll mine are set to frozen and I still have the problem :/
-
Scorpion over 10 years@DontFretBrett try to set of Frozen = False.
-
TaW over 9 yearsTo 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 about 8 yearsJust stumbled upon the same problem after copying example code from MSDN online docs.
-
RBT almost 8 yearsFor 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 over 7 yearsFor me the problem was that i had a column with AutoSizeMode property to Fill, i changed it to DisplayedCells and worked fine.
-
braX over 6 yearsThis was exactly my problem and now it's fixed. Not sure why it's down-voted.
-
gumuruh about 6 yearsthat's true! 100% for me as well here using VS2013 under win7. Thanks @Dan .
-
Ananda Prasad Bandaru almost 6 yearsIf all are frozen then it would not work. At least the last columns needs to have Frozen=false
-
NadimAJ over 3 yearsI 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 about 3 yearsI'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.