How to auto resize columns in DataGrid? 
Author Message
 How to auto resize columns in DataGrid?

Hi,

The MSFlexGrid control has an AutoResize column property but the DataGrid
control doesnt so I need to know how to resize each column to the length of
the longest cell in each column.  I think I need know the text length of the
longest cell in a row in a particular column in order to get the length but
I'm not sure how to do this, any ideas?

Thanks



Sat, 13 Mar 2004 05:07:33 GMT  
 How to auto resize columns in DataGrid?
Paul

Try

DataGrid.Columns(Y).Width = Me.TextWidth(String(objRS.Fields(Y).DefinedSize,
"WWWWW"))

Instead of W you may use any other letter to suit your needs

Sukesh


Quote:
> Hi,

> The MSFlexGrid control has an AutoResize column property but the DataGrid
> control doesnt so I need to know how to resize each column to the length
of
> the longest cell in each column.  I think I need know the text length of
the
> longest cell in a row in a particular column in order to get the length
but
> I'm not sure how to do this, any ideas?

> Thanks



Sat, 13 Mar 2004 09:01:26 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Auto resize flexgrid columns - Help!

2. DGrid: Auto Resize columns

3. Auto resizing column width for grid and listview...

4. auto resizing columns in listview objects

5. Auto resizing column width for grid and listview...

6. Auto resizing column width for grid and listview...

7. Auto resizing column width for grid and listview...

8. Problem with auto resize on datagrid row header

9. MS DataGrid Column "Auto"sizing

10. Auto-sizing DataGrid columns

11. MS DataGrid Column "Auto"sizing

12. Datagrid Column Resizing

 

 
Powered by phpBB® Forum Software