Reputation: 604
How should I design my DataGridView
to have a title of DB table above it, and to dock both (title and DataGridView
) into a container? I tried with ToolStrip
, but they both dock in the left corner, and one covers another.
Upvotes: 0
Views: 2088
Reputation: 2712
I suggest you use a TableLayoutPanel
control with 1 column and 2 rows.
Dock(Top) the control you desire to work as title - Label
for instance - or whatever you wish in first row, then set the row to autosize
Dock(Fill) the DataGridView
in second row and set the row to percent (100%)
Set margins of both controls to (0;0;0;0) if you consider the gaps unsdesirable.
Place the TableLayoutPanel
in your form the way you'd do with the single DataGridView
Upvotes: 1