|C# WinForms .Net 3.5
I have datagridview that displays a list of entries pulled from a database. This part works.
The datagridview has 'ScrollBars' set to 'Both'.
The setup is as follows...
TabControlMain has 2 pages, TabControlMain.page1 has a tabcontrol of which its first page contains the DGV in question.
TabControlMain.page2 also has a tabcontrol.
When the entries load (added via 'ReportProgress' event of background worker) then scroll bars appear as desired.
However, If the entries are loaded when TabControlMain.page2 is displayed and the user selects TabControlMain.page1, then the scroll bars are disabled, even thou the content is larger than the display area. If the user click a button to reload the list, then they appear again.
Basically, if the datagridview is populated while it is not visible then the problem occurs.
Also to note, that the DGV is part of a userControl.
Has anybody come across this issue before?
So far I have had no luck, my best idea was to try to update the DGV whenever the page is reselected. But I have tried .Refresh, .Update, .Invalidate...
...Just tried setting 'ScrollBars' to 'None' and then back to 'Both' when the DGV is reselected and the scrollbars are enabled again. This is what I want but is not the ideal solution. Can anybody offer a better alternative? Or reason why it happens in the first place?
Life goes very fast. Tomorrow, today is already yesterday.