How to set the ListViewItemSorter Property

  • Thread starter Thread starter Jeff0803
  • Start date Start date
J

Jeff0803

Guest
I'm making codes to sort by headercolumn click of the listview control.

I followed the code in this site.

However an error occur when compiled.

Error 1 Cannot implicitly convert type 'WindowsApplication1.ListViewColumnSorter' to 'System.Collections.IComparer'. An explicit conversion exists (are you missing a cast?) C:\CSharpSample\ColulmHeaderSortTest\WindowsApplication1\WindowsApplication1\Form1.cs 20


The error occur when set the ListViewItemSorter property.

private ListViewColumnSorter lvwColumnSorter;
public Form1()
{
InitializeComponent();
// Create an instance of a ListView column sorter and assign it
// to the ListView control.
lvwColumnSorter = new ListViewColumnSorter();
this.listView1.ListViewItemSorter = lvwColumnSorter;// Error!
}
Can anybody give me some advice?

Continue reading...
 
Back
Top