0

I have a forms application, showing results of several DataTables into several DataGridViews, each appearing in a different tab of an application.

I've noticed weird behavior when I reload the data (a single button invokes filling all DGVs from the matching DTs): DGVs with a lot of rows (which require vertical scrolling) which are not shown (only one is shown since they are in a tab control) don't have their scroll bars after the data fetch. But a window resize will show the scroll bars though...

I've tried forcing a dgv.Refresh() on each DGV after the dgv.DataSource = dt, but no luck.

Any input will be appreciated.

Cheers!

Shay
  • 41
  • 1
  • 4

3 Answers3

0

Maybe this after populating it?

dgv.ScrollBars = ScrollBars.Vertical;

Hope it helps, if not, could you show us how you're populating them?

Thanks.

lb.
  • 5,666
  • 3
  • 17
  • 16
  • Hi Leo, The population is done by an assignment of a typed DataTable to the DGV's data source. The Srollbars property is set to Both... – Shay Aug 26 '09 at 14:39
0

I have a slightly similar issue, but maybe this may help in sparking an idea for you. For me, it appears to be something to do with the way my controls are docked. I found a rather convoluted solution which in short, says to add a new panel, and re-position the controls again on top of that panel. Since i found that re-sizing the form after all my controls appears to bring back the scroll bars, I just added a me.width = me.width+1 as my last statement to my form_load event.

DaneAnthony
  • 246
  • 2
  • 2
0

My situation sounds pretty much identical to yours. I was having this same issue and found out it was because I was disabling and enabling the tabs in a background thread. Once I moved the calls to disable and enable the tabs to the main thread the scrollbars behaved normally.

Kim
  • 1,068
  • 13
  • 25