Object Reference > True DBGrid Methods > AutoSize Method |
AutoSize Method
Automatically sizes the column width.
column.AutoSize
Arguments
None
Return Value
None
The AutoSize method adjusts the width of a column to accommodate the longest visible field within that column. Calling this method in code has the same effect as the user double-clicking a column divider.
If the column is hidden or scrolled out of view, calling this method results in a trappable error.
The AllowSizing property must be set to True for columns to be resized by the user. However, you can use the AutoSize method when the column's AllowSizing property is False, just as you can set the column width when AllowSizing is False.
See Sizing Columns for more information.