• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 480
  • Last Modified:

How do resize listview colums widths programatically in compact framework?

I have a listview called lvPoints. I know how to set the thing up prior to data being added but once the data has been added how do I resize each column programmatically?

I found an article http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.autoresizecolumn%28v=vs.90%29.ASPX that says to use the AutoResizeColumn property but that is not supported in my version of compact framework. The target device is a Win Mobile 6.5 pro.

Thanks
0
PBLack
Asked:
PBLack
  • 2
1 Solution
 
PBLackAuthor Commented:
VB.Net 2008 is being used.
0
 
CodeCruiserCommented:
According to the [MSDN page] on column widths:

This property enables you to set the Width of the ColumnHeader. The ColumnHeader can be set to adjust at run time to the column contents or heading. To adjust the width of the longest item in the column, set the Width property to -1. To autosize to the width of the column heading, set the Width property to -2

For your purposes you should be setting the column width to -1. Note that you will have to do this after adding the items to the list.


http://stackoverflow.com/questions/6149806/adapt-column-width-of-a-listview-to-its-content
0
 
PBLackAuthor Commented:
Thanks
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now