System.Windows.Forms.ListView.Sort C# (CSharp) Method

Sort() public method

public Sort ( ) : void
return void
		public void Sort ()
		{
			if (virtual_mode)
				throw new InvalidOperationException ();

			Sort (true);
		}

Same methods

ListView::Sort ( bool redraw ) : void

Usage Example

        public void AddFile(string file)
        {
            if (FileIsLoaded(file))
            {
                return;
            }

            FileInfo fi = new FileInfo(file);

            if (!fi.Exists)
            {
                throw new FileNotFoundException("The file does not exist.", file);
            }

            string size     = (fi.Length / 1024.0).ToString("N2") + " KB";
            string path     = Path.GetDirectoryName(file);
            string name     = Path.GetFileName(file);
            string modified = fi.LastWriteTime.ToShortDateString() + " " + fi.LastWriteTime.ToShortTimeString();

            string[]     itemValues = { name, modified, size, path };
            ListViewItem item       = new ListViewItem(itemValues);

            listViewActiveFiles.Items.Insert(0, item);

            listViewActiveFiles.Sort();
        }
All Usage Examples Of System.Windows.Forms.ListView::Sort
ListView