Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1065
How to get the maximum length of a column's contents
posted

Hello!

How do I get the maximum length of a column's contents?

I have a UltraGrid with more than 100 columns and 2000 - 3000 rows.
I need a fast solution that returns me for each column the maximum length of its rowcells.
At the moment I'm iterating through all columns and all rows... This takes too much time.

Is there any better solution?

Parents
  • 469350
    Suggested Answer
    Offline posted

    What do you mean by "length?" Are you talking about width of the text on the screen or the number of characters displayed?

    If you want to autosize the column to the width of it's contents, then the grid has built-in support for that via the PerformAutoResize method on the column.

    If you want the length of the text, then there's no way to do that other than looping through the rows. But it might be more efficient to loop through the rows in the data source, rather than the grid.

Reply Children
No Data