iqmedia
asked on
DBGrid in D3 question...
Hi expert(s),
My Q's:
1) How to clear the grey line in DBGrid so when it show the data, it just look plain white?
2) Some of my fields are vary in size such as char(50) etc. How could I resize the columns auto/manually?
Sample:
FieldA | FieldB |
1 | Banker |
2 | Student |
I dont want it to be like above eventhough the FieldB is char(50).. I want it to be like this: (it can be resize)
Sample:
FieldA | FieldB |
1 | Banker |
2 | Student |
TQ...
iqmedia
My Q's:
1) How to clear the grey line in DBGrid so when it show the data, it just look plain white?
2) Some of my fields are vary in size such as char(50) etc. How could I resize the columns auto/manually?
Sample:
FieldA | FieldB |
1 | Banker |
2 | Student |
I dont want it to be like above eventhough the FieldB is char(50).. I want it to be like this: (it can be resize)
Sample:
FieldA | FieldB |
1 | Banker |
2 | Student |
TQ...
iqmedia
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks again...
iqmedia
iqmedia
Glad to help you,
thanx for points.
thanx for points.
ASKER
I found a solution based on your sample code...
procedure Form1.Table1AfterOpen(Data
var
Max, W, i : integer;
begin
Max := 0;
Table1.DisableControls;
for i := 0 to 5 do // if you have 6 colums fields
begin
while not Table1.EOF do
begin
W := DBGrid1.Columns[i].Field.D
if W > Max then
Max := W + 4 // adding 4 char or not will still look good
else
Max := DBGrid1.Columns[i].Width + 4;
Table1.Next;
end;
end;
Table1.First;
Table1.EnableControls;
end;
Thanks... I accept your sample code as an answer.
iqmedia