I've just added a bit of code to the .net2 listview and its causing an
exception in vs2005. The additional code just autosizes the last column
which i learned how to do from the code project.
protected override void WndProc(ref System.Windows.Forms.Message message)
{
const int WM_PAINT = 0xf;
switch (message.Msg)
{
case WM_PAINT:
if (this.View == System.Windows.Forms.View.Details && this.Columns.Count > 0)
this.Columns[this.Columns.Count - 1].Width = -2;
break;
}
base.WndProc(ref message);
}
Heres the exception message it gives me
The control core.mylistview has thrown an unhandled exception in the designer and has been disables
Exception:
The file D:\Documents\Visual Studio 2005\projects\server\main.cs cannot be modified in the designer while building or debugging
stack trace:
at core.mylistview.WndProc(Message&message) in D:\Documents\Visual Studio 2005\projects\server\controls\listview.cs:line39
This
happens when its compiled on either an x86 or an x64 machine. If I
compile it in visual studio 2003 it works perfectly. Has anyone else
come accross this and does anyone know a work around

Listview causing an exception in vs2005
techiedella
if (!this.DesignMode) {}
dba123
ninajean
Jessel
Harsh Modi - MSFT
Naids