TWild Posted February 27, 2003 Posted February 27, 2003 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! Quote
stustarz Posted February 27, 2003 Posted February 27, 2003 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 Quote Visit: VBSourceSeek - The VB.NET sourcecode library "A mere friend will agree with you, but a real friend will argue."
TWild Posted February 27, 2003 Author Posted February 27, 2003 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 :) Quote
*Gurus* divil Posted February 27, 2003 *Gurus* Posted February 27, 2003 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 Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
TWild Posted March 4, 2003 Author Posted March 4, 2003 OK, I finally found out how to do this. I uploaded a zip containing two dlls with source to my site. ListViewOrder.dll allows you to set/get order of columns ListViewWidth.dll allows you set/get width of columns http://www.thewildhome.com/listview_order_width_vbnet.zip Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.