Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi everyone!

Can anyone tell me how to get the column order after a user reorders the columns on the listview? I couldn't remove then add the columns, because my subitems will all be off. Thanks for any help!

Posted

Hi

 

I don't know whether this will help but MSDN has an entire article on sorting columns (including dates) which also has a section on sorting in ascending or descending order using a variable:

 

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/listviewsort.asp

 

If you don't want to amend your existing code just look at this:

 

http://msdn.microsoft.com/library/en-us/dnwinforms/html/listviewsort.asp?frame=true#sorting_ascendingdescending

Visit: VBSourceSeek - The VB.NET sourcecode library

 

 

"A mere friend will agree with you, but a real friend will argue."
Posted

Thanks for the reply! But, sorting is not a problem. I have the 'allowcolumnreorder' property set to true for my listview. After a user reorders the columns, I want to be able to save the order so when they come back, the columns are in the order they put them in. There has to be something somewhere that has that order stored in it. Keep in mind the columns are not changing place in the column collection. They keep their same index number.

 

Sorry I wasn't clear enough :)

  • *Gurus*
Posted

There is no method in the .NET listview control to get or set the column order once you have set AllowColumnReorder to true and the user has modified them.

 

However, in the following article someone has gone to the trouble of writing a class that uses the API to get the column order to serialize the listview. You should be able to extract the relevant information from that.

 

http://www.c-sharpcorner.com/Code/2002/Dec/ListViewSerialization.asp

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...