Asmitagoyal
asked on
Sizing Columns of a dbgrid at runtime
hi everybody
i am facing a problem with dbgrids.
i am using a single grid for displaying data of different tables. each table is having different number of fields.
so when assinging the query to the grid at runtime ... in some tables where number of fields is less empty space is left at the right of the grid .. and when the number of fields are more a horizontal scrollbar appears on the grid.
i want my form size to remain the same.
i hope the question is understood.
thanks in advance
i am facing a problem with dbgrids.
i am using a single grid for displaying data of different tables. each table is having different number of fields.
so when assinging the query to the grid at runtime ... in some tables where number of fields is less empty space is left at the right of the grid .. and when the number of fields are more a horizontal scrollbar appears on the grid.
i want my form size to remain the same.
i hope the question is understood.
thanks in advance
ASKER
hello
using dbgrid1.Columns[index].Wid th := ... is a cumbersome task
i've to know the width of all the fields in advance ... which is not possible.
i don't want neither the extra free space nor the scroll bar .
if there is any other method for this ...... kindly suggest
using dbgrid1.Columns[index].Wid
i've to know the width of all the fields in advance ... which is not possible.
i don't want neither the extra free space nor the scroll bar .
if there is any other method for this ...... kindly suggest
>if there is any other method for this
no, not as i know ->
you have to calculate the width byself depending on count of fields and type of field
meikl ;-)
no, not as i know ->
you have to calculate the width byself depending on count of fields and type of field
meikl ;-)
>using dbgrid1.Columns[index].Wid th := ... is a cumbersome task
>i've to know the width of all the fields in advance ... which is not possible.
cumbersome??? Asmita, if you think this way, there is NO way.
You don't need to know the width of all fields. You can write a generic routine which can work for all tables. Let me know if you need more help on this.
>i've to know the width of all the fields in advance ... which is not possible.
cumbersome??? Asmita, if you think this way, there is NO way.
You don't need to know the width of all fields. You can write a generic routine which can work for all tables. Let me know if you need more help on this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
not really, what is wrong with the scrollbar and the free space(if there are less columns)?
thats a kind of dynamic, which keeps your form in the current metrics
nevertheless you can adjust the column-width like (preferable in the afteropen-event of your dataset)
dbgrid1.Columns[index].Wid
meikl ;-)