DataGridView doesn't resize with the main window when sorted

DataGridView doesn't resize with the main window when sorted

Post by S2lrb3 » Wed, 19 Apr 2006 03:41:01

Hi all.

Kinda weird problem. I have a small app (main form with no borders and with
custom Min, Max, Close buttons, a panel inside of this form, DataGridView
inside of that panel and several drop downs and buttons below the grid as
children of the panel). The grid has sorting enabled, has anchors to all
sides, one column is a check box and it's frozen. Most of the settings of
that grid are pretty much defaults.

The idea of this app is to get some data from web service every 2 seconds
and bind it to the grid. Each call to the web service is done in a separate
thread. Everything works just fine, exactly the way I wanted except when I
sort any column in the grid and then resize the main window the size of the
grid remains the same as it was before I clicked the column to sort it; if
windows gets bigger that the size of the grid it just stays the same saze. If
window became smaller than the grid then scroll bars won't appear at all.
Then if I sort any column again, the grid will adjust itself to the proper
sizes and scroll bars will appear properly (if needed).

And if I don't sort the grid then everything works as it supposed to: resize
the window and grid will resize with it or scroll bars will appear.

I know I'm missing something small here but can't figure it out :(
Any kind of help will be highly appreciated!!