0

I can drop controls onto my form from my toolbox with no problem, but if I drag and drop the control around the form I get this error message:

"The control System.Windows.Forms.DataGridView has thrown an unhandled exception in the designer and has been disabled.

Exception:
Value cannot be null.
Parameter name: child"

And it paints an error image on the control. This error is only happening on one of my forms and everything runs the way it should when I debug. It's not a huge problem but it gets rather annoying when every time I move any control around on this particular form, I get this error and it paints an error image across the control. Here is the message that the error image displays on the control:

"System.ArgumentNullException: Value cannot be null.
Parameter name: child
at System.Windows.Forms.Control.ControlCollection.SetChildIndexInternal(Control child, Int32 newIndex)
at System.Windows.Forms.Control.ControlCollection.SetChildIndex(Control child, Int32 newIndex)
at Microsoft.VisualBasic.PowerPacks.Design.EventManager.Reparent(ShapeContainer shCon)
at Microsoft.VisualBasic.PowersPacks.Design.EventManager.OnEndDrag(Object sender, BehaviorDragDropEventArgs e)
at System.Windows.Forms.Design.Behavior.BehaviorService.OnEndDrag(BehaviorDragDropEventArgs e)
at System.Windows.Forms.Design.Behavior.BehaviorService.DoDragDrop(DropSourceBehavior dropSourceBehavior)
at System.Windows.Forms.Design.ControlDesigner.OnMouseDragMove(Int32 x, Int32 y)
at System.Windows.Forms.Design.ControlDesigner.WndProc(Message& m)
at System.Windows.Forms.Design.ControlDesigner.DesignerWindowTarget.OnMessage(Message& m)"

Thanks and any help will be greatly appreciated.

JG_30
  • 37
  • 2
  • 8
  • First time I've seen this go wrong, this designer is pretty solid. It sure is scrambled all to hell, looks like you are moving a Shape control but it is complaining about a DataGridView. Some of your own code runs at design time as well, always a good way to have random stuff going wrong. – Hans Passant Jun 11 '13 at 18:34
  • I can't find anything different between this form and my other forms. This form had been working correctly several days ago and yesterday out of the blue, I move a control to a different location on the form and it throws this error and have been getting this same error every time I move any other control. – JG_30 Jun 11 '13 at 18:54
  • Hans, I'm glad you said something about the shape control, I had one shape control on my form and once I removed it, I no longer get the error when moving controls around on the form. Still weird because I use those controls all the time and have never had this problem. – JG_30 Jun 11 '13 at 19:03

0 Answers0