简体   繁体   中英

SplitContainer error

I've got this error report:

Collection is read only.
at System.Windows.Forms.SplitContainer.SplitContainerTypedControlCollection.SetChildIndexInternal(Control child, Int32 newIndex)
at System.Windows.Forms.Control.ControlCollection.SetChildIndex(Control child, Int32 newIndex)
at System.Windows.Forms.Control.UpdateChildControlIndex(Control ctl)
at System.Windows.Forms.Control.WmWindowPosChanged(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

I have no idea what it is, and search just gave me one msdn post without solution. Any ideas? What this exception is about at all, I'll probably find the way to fix it if I find some general description how this can happen?

Somewhere in your code, you are trying to delete the internal panels of the SplitContainer controls

Something like this reproduces the error:

splitContainer1.Controls.RemoveAt(0);

You will have to search in your code where you are trying to delete or remove child controls. Could easily be from a recursive method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM