moldov
moldov

Reputation: 31

DataGridView size is out of splitContainer panel even the Dock property is Fill

There are a SplitContainer and couple of DataViewGrids. In Designer I docked DataViewGrids to Panel1 and Panel2 of SplitContainer respectively. So, in designer everithing seems to be OK. But when I start the program, the DataGridView seems like it's docked to the main form, because the size of the Grid is the main Form size. I use the Grids with bindings to DataSet. When I try to use not binded blanc Grids, everithing is ok. The grids size matches the splitContainer Panels sizes. That drives me insane:(

Upvotes: 1

Views: 3892

Answers (2)

moldov
moldov

Reputation: 31

So I resolved, that problem. I put that code after all data bindings of dataGRidView

dataGridViewPO.Dock = DockStyle.Fill;
dataGridViewPO.Parent = splitContainer1.Panel1;

Upvotes: 2

DeveloperX
DeveloperX

Reputation: 4683

ok you should set dockstyle of grid to fill the panel as this

datagrid1.Dock=DockStyle.Fill;

Upvotes: 2

Related Questions