LuckyLuke82 LuckyLuke82 - 4 months ago 31
Vb.net Question

Title above DataGridView

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.

Answer

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

Comments