Treeview crash with large number of nodes.

Treeview crash with large number of nodes.

Post by S2V2aW » Wed, 07 Feb 2007 03:13:01


when clearing a treeview with large number of nodes, it works find without the
BeginUpdate() and BndUpdate() call wrap around the .Clear() method, it's
just slow.

when using the BeginUpdate() and BndUpdate(), the treeview crash with the
following error.

Error Message: System.NullReferenceException: Object reference not set to an
instance of an object.
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TreeView.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd,
Int32 Msg, Int32 wParam, IntPtr lParam)
at System.Windows.Forms.TreeNode.Remove(Boolean notify)
at System.Windows.Forms.TreeNode.Clear()
at System.Windows.Forms.TreeNodeCollection.Clear()
at FrontEnd.frmLawyerSearch.DoSearch() in

Call Stack:
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr,
Int32, IntPtr, IntPtr)
at System.Windows.Forms.NativeWindow.DefWndProc(Message&)
at System.Windows.Forms.Control.DefWndProc(Message&)
at System.Windows.Forms.Control.WndProc(Message&)
at System.Windows.Forms.TreeView.WndProc(Message&)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message&)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message&)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32,
IntPtr, IntPtr)
at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef, Int32,
Int32, IntPtr)
at System.Windows.Forms.TreeNode.Remove(Boolean)
at System.Windows.Forms.TreeNode.Clear()
at System.Windows.Forms.TreeNodeCollection.Clear()
at FrontEnd.frmLawyerSearch.DoSearch()
at FrontEnd.frmLawyerSearch.btnSearch_Click(Object, EventArgs)