Dave_B_C
asked on
DBGrid columns
I have a program that displays Access table data via a DBGrid. I have diligently changed the field column widths in the grid so the row fits the window, but when I run the program it displays with column widths bearing no resemblance to those I put in! They do not match those used in native Access either. How do I prevent this?
Dave
Dave
Did you already "Add Fields" on Fields Editor (from TDataset and it's descendant components)?
With this you could set the columns width manually on design time.
Regards,
Dewo
With this you could set the columns width manually on design time.
Regards,
Dewo
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I already did what you suggested Dewo... What seems to happen is that if you change the width at design time to be less thn the column header, it overrides this at execution time and sets the column width to be the width of the label + a space. Now I know this I can live with it, but thanks for your help anyway!
If I get desperate I'll try Phili's suggestion, but for now I'll just jugglee things at design time..
Dave
If I get desperate I'll try Phili's suggestion, but for now I'll just jugglee things at design time..
Dave
O, I see, the real problem is because you try to set the column width less than it's caption width. Why are you not change the caption with the shorter one? :)
Regards, Dewo
Regards, Dewo
example :
DBGrid1.Columns[0].Width := 100; // where 0 is the first column in the grid.