Column rearrange in list view

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

does anyone have a good method or technique for saving the order of columns
that someone rearranged them to and restoring that order on the applications
next load?
 
Using the .NET Framwork 1.x you need to use the Win32 API to get/set the
position of a column since that property is not exposed by .NET.

Using .NET 2.0 you have ColumnHeader.DisplayIndex or similar.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
I am using .NET 2.0 at the moment, but not sure how to save the states and
restore them properly..
 
Well, when you close the window, you iterate ListView.Columns to get the
Text and DisplayIndex pairs and you store them somewhere, for example in the
Windows registry
(HKEY_CURRENT_USER\Software\YourCompany\YourApp\YourWindow\YourListview).
When you load the window again, you retrieve the pairs and for each column
you set its DisplayIndex...

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top