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
12
votes
3 answers
Moving Columns in a DBGrid seems to move the attached DataSet fields
I observed something last week that I did not expect, and will describe below. I am curious as to why this happens. Is it something internal to the TDataSet class, an artifact of the TDBGrid, or something else?
The order of the fields in an open…

Cary Jensen
- 3,751
- 3
- 32
- 55
10
votes
8 answers
How to auto fit/scale DBGrid's (or other similar) columns widths according to its contents?
I am trying to make a frame with a DBGrid that will serve for more than 10 tables with half of its fields as defaults, and other fields exclusive for each table.
As the space for the columns are limited and I do not want to configure each column of…

NaN
- 8,596
- 20
- 79
- 153
8
votes
3 answers
Finding the current row in Delphi's TDBGrid
Is there a way of finding out which row is current in a TDBGrid?

BubbaT
- 1,810
- 4
- 21
- 24
8
votes
4 answers
How to modify a cell value in Delphi TDBGrid
I have to display some modified 'masked' value in a VCL TDBGrid (Delphi XE2), ie : change 'password' to 'xxxxxxxx' or uppercase 'pass' to 'PASS' or others.
As my Fields are dynamically created (but the Name is coded so I know how and when mask them…

philnext
- 3,242
- 5
- 39
- 62
7
votes
2 answers
Delphi dbgrid continuous scrolling
I'm making an application that holds orders and prints invoices. I have some labels, tedits, tmemos, buttons, a datasource, an adotable, a popupmenu, and a dbgrid on my form.
When I build the program and scroll down the dbgrid scrollbar, it scrolls…

nikel
- 653
- 4
- 13
- 24
7
votes
3 answers
How do I refresh a TDBGrid?
I have a TDBGrid called myDbGrid that I want to update after a change to the database (insert/update/delete). How can I do this without reloading my form completely?
myDbGrid uses myDataSource and it uses myQry as its data set.
I've tried the…

BIBD
- 15,107
- 25
- 85
- 137
6
votes
1 answer
How do I get screen coordinates of the DBGrid cell
I want to show popup button or fancy message (with coloured background, etc) just under right-bottom corner of particular cell of the current row.
For now I only figured how to get grid coordinates:
x = DBGrid.DataSource.DataSet.RecNo
y =…

Alexander Malakhov
- 3,383
- 2
- 33
- 58
6
votes
1 answer
Detect which cell was clicked in TDBGrid when dgRowSelect is set to True?
In Delphi 2010 is there any way to detect which cell was clicked when dgRowSelect is set to True ?
Normally I would use the OnCellClick(Column: TColumn) event handler, but this does not work as expected. With dgRowSelect = False this procedure gets…

srayner
- 1,799
- 4
- 23
- 39
5
votes
1 answer
How can I restore a TDBGrid record view to the condition before a refresh?
Possible Duplicate:
How to avoid TDbgrid scrolling when returning to a previous location
I am looking for a way to save and restore the vertical scrolling position of a Delphi TDBGrid after a refresh has occurred. Currently, the grid resets…

cdburgerjr
- 155
- 3
- 9
5
votes
1 answer
Setting TDBGrid visible rows
I want to adjust a TDBGrid height given a VisibleRows parameter. the grid may or may not have titles.
Suppose I select 100 records from the db, but I want the grid height to adjust to show the first 10 rows (make them visible). the dataset will…

zig
- 4,524
- 1
- 24
- 68
5
votes
0 answers
Calling the OnDrawColumnCell procedure Delphi DBGrid
I have DBGrid which stores client information and the expiry dates of memberships. I am using the following code on the OnDrawColumnCell event of the DBGrid to color rows which include memberships which are expiring (teal) or expired…

Turtle254
- 115
- 3
- 9
5
votes
5 answers
DBGrid Highlighting the located row via code?
I got the :
ADOTable1 ( codepeople as integer, namepeople as string )
DataSource1 ( the DateSet is ADOTable1 )
DBGrid1 ( connected to DataSource1, Options-dgRowSelect is true )
I locate a row on ADOTable1 with the following code
…

Galvion
- 1,353
- 7
- 23
- 35
5
votes
2 answers
Why is the vertical Scrollbar on a TDBGrid not displayed?
I have two DB grids on a form and one has a vertical scrollbar and the other doesn't, even when the DataSource query returns more results than the Grid's visible rows.
Why is the vertical scrollbar on the TDBGrid not displayed?
[Update] Delphi XE2…

Mawg says reinstate Monica
- 38,334
- 103
- 306
- 551
5
votes
1 answer
TDBGrid status bar for column aggregate
Got a grid with some numeric columns and it's need to implement for each column an aggregate (sum or count) and display it under the corresponding column.
I know that some suites (DevExpress or other) had already implemented "by default". But there…

DreadAngel
- 772
- 11
- 30
4
votes
1 answer
DBGrid How to hide Titles row and Indicator column?
Is there a way to hide the Titles row and the Indicator column on a DBGrid? I couldn't find any property of this kind. Can I do it programmatically?

user2383818
- 709
- 1
- 8
- 19