ListView Sorting Problem

  • Thread starter Thread starter Steve Z.
  • Start date Start date
S

Steve Z.

I am trying to implement the sorting of a ListView object by clicking
on a column (using the example at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/listviewsort.asp).
While debugging it I get the following exception:


An unhandled exception of type 'System.OutOfMemoryException' occurred
in System.Windows.Forms.dll

Additional information: Error creating window handle.


It is occuring at any line where I try to set the listView.Sorting
property. For example:

this.listView.Sorting = SortOrder.Ascending;


The moment I comment this line out, the exception goes away. I was
wondering if anyone had encountered this before or knew what is causing
this.

Thanks,
Steve
 
Most likely something is wrong in your sorting routine, but you didn't show
that code so... (the code in the article works fine for me)

/claes
 
Code for sorting is identical to that which is in the article. Strange
thing is, if I move the sorting code to a test project, it works fine.
Or if I go to debug and step through the code, it is fine. It doesn't
make sense how just changing a property should result in this error.
 
Back
Top