ListView Sorting Problem

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
 
C

Claes Bergefall

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
 
S

Steve Z.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top