userPro
userPro

Reputation: 59

Delphi TDBGrid without any row inserted

I use three component to save same data : TDBGRid, TDatasource and a MessageTable. I set the edition mode for my DBGrid

MessageDBGrid.Options := MessageDBGrid.Options + [dgEditing];

My question is simple but i can't do that : how can display a DBGrid without any row ? At start, i need to display juste the header for fields.

Upvotes: 0

Views: 668

Answers (1)

Ken White
Ken White

Reputation: 125630

There is no way to display a DBGrid with zero rows. It will always have one data row, even for an empty table, and even with no datasource assigned it shows an empty row (that is one column wide).

See, for instance, this DBGrid, dropped on a new, blank VCL form in a new, empty VCL application with no other controls:

Image of empty TDBGrid with single data cell

Upvotes: 2

Related Questions