TDBGrid is a VCL control used to display and manipulate records from a TDataset in a tabular fashioned way. It is defined in DbGrids.pas unit.
Questions tagged [tdbgrid]
156 questions
4
votes
1 answer
DBGrid XE3 background color
{*-----------------------------------------------------------------------------
Unit Name: TopFormU
@Author Mr. Arch Brooks, Software Engineer, Brooks Computing Systems LLC
@Version 1.0
Date: 04-Jan-2014
Purpose:
History:
…

Arch Brooks
- 183
- 1
- 3
- 19
4
votes
5 answers
How do I make a TDBGrid's columns fit the grid's width?
I've got a TDBGrid with predefined columns, and I just can't get the width right. I can mess with the Width property of the columns in the Form Designer and get the width to look just right at design time, but at runtime, for whatever reason, the…

Mason Wheeler
- 82,511
- 50
- 270
- 477
4
votes
1 answer
Change DBGRID row color on field value in delphi
How to change color of dbgrid rows that have the same value on a field in delphi?
for example all rows that have the same teacher
note: those rows are grouped, and come after each other in dbgrid
thanks in advance

teocka
- 127
- 1
- 1
- 8
4
votes
4 answers
Reassigning a datasource at run-time
I did some searching and only found more unanswered questions. :)
Using D5pro.
I want to reassign the DataSource to a TDBGrid at run time. I have seven identical structured DataSets and depending on a button click I want the appropriate DataSet…

user983145
- 219
- 1
- 3
- 12
4
votes
3 answers
How to display TIMEDIFF(now, then) in a DB Grid?
Sorry, I am very new to DbGrids.
Should I use the query's field editor and somehow add a new field that captures the TIMEDIFF and then just add that as a column in my DbGrid?
Or can/should I skip the field editor and somehow declare the TIMEDIFFF as…

Mawg says reinstate Monica
- 38,334
- 103
- 306
- 551
3
votes
3 answers
Print a TDBGrid
How can I print a DBGrid without installing or downloading components?
OR
How can I get a DBGrid's data into a RichEdit so that I can print it from there?

Arno
- 31
- 1
- 2
3
votes
1 answer
Is there a way to determine if scrollbars are visible on a TDBGrid
I want to display something in the bottom right of a TDBGrid, but I don't want to overwrite the scrollbars.
Is there a nice way of determining if the scrollbars are visible? (and their size)

Alister
- 6,527
- 4
- 46
- 70
3
votes
2 answers
Run-time Equivalent to Assign Local Data... for TClientDataSet and TSQLQuery
The TSQLQuery class is unidirectional, so for it to be used as a source for a data-bound TDBGrid, a TClientDataSet needs to be linked between the TSQLQuery and the TDataSource that the TDBGrid is bound to.
I can connect the TSQLConnection and make…

SiBrit
- 1,460
- 12
- 39
3
votes
1 answer
Limit maximum text length of the inplace editor in TDBGrid
How can I limit the maximum text length of the inplace editor in TDBGrid? (Delphi Berlin)
The Data Type is Float.

Hossein Yarmohamady
- 43
- 6
3
votes
5 answers
Delphi TDBGrid selected row get value
I would like to retrieve a value from a TDBGrid the selected row, how can I do?
procedure TForm7.Button2Click(Sender: TObject);
var
i, j: Integer;
s: string;
begin
if DBGrid1.SelectedRows.Count>0 then
with…

Nu Carvignulu
- 61
- 1
- 1
- 15
3
votes
2 answers
Mouse over dbgrid's title
Is there a way to capture name of title with mouse move over Dbgrids title?
Idea is to make title name visible only when cursor is moved over title's field.
Tnx in advance.

Ledzouz
- 59
- 8
3
votes
1 answer
How to add an image with transparency to a TDbgrid column in delphi?
I am trying to add an image to a column on a TDbgrid that takes transparency into account. When drawing the image from a TImageList on the canvas in the DBGridDrawColumnCell procedure, I need the background of the image (the same color as the pixel…

Ron Swingler
- 49
- 1
- 5
3
votes
4 answers
How to get DBGrid to draw Yes/No rather than True/False
I'm trying to replace True/False with Yes/No in a DBGrid. The code below almost works:
procedure TDatamodule1.DBGridDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
sText :…

Mike
- 153
- 3
- 11
3
votes
2 answers
Restore horizontal scroll position in TDBGrid
I wrote a simple method to sort column in TDBGrid.
If Option.RowSelect set to False everything works fine, but if RowSelect gets True the horizontal position scroll doesn't restore after sort column.
So I try GetScrollPos and SetScrollPos to restore…

Kachwahed
- 542
- 7
- 17
3
votes
2 answers
How to manipulate the contents of a DB Grid before display?
I have a column in a DB table which stores pressure. The pressure is always stored as PSI and can be converted to BAR by diving by 14.5.
The user can toggle display of PSI/BAR with a Radio Group.
I was using a TStringGrid and am converting to a…

Mawg says reinstate Monica
- 38,334
- 103
- 306
- 551