I'm trying to add an object to this.Controls, using this.Controls.Add()
on a Panel object.

When I'm trying to do so, an ArgumentException is thrown. According to
MSDN, an ArgumentException is thrown by ControlCollection.Add() if the
child parameter does not specifiy a control.

If I catch the exception, and read out the Type of the object I added
(using GetType() ), I'm getting System.Windows.Forms.PictureBox (as
expected).

What am I missing here?

Re: ArgumentException when adding to this.Controls by Daniel

Daniel
Fri Sep 09 15:20:37 CDT 2005

Post a full repro sample that I can run...

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

<Guus.der.Kinderen@gmail.com> wrote in message
news:1124790044.445657.274800@g43g2000cwa.googlegroups.com...
> I'm trying to add an object to this.Controls, using this.Controls.Add()
> on a Panel object.
>
> When I'm trying to do so, an ArgumentException is thrown. According to
> MSDN, an ArgumentException is thrown by ControlCollection.Add() if the
> child parameter does not specifiy a control.
>
> If I catch the exception, and read out the Type of the object I added
> (using GetType() ), I'm getting System.Windows.Forms.PictureBox (as
> expected).
>
> What am I missing here?
>