G
Guest
Hi
I have one panel. It have 2 labels control and one abstract class control. In one event
I want to remove all labels control from that panel.
So I use this way.
foreach (Control c in this.panel1.Controls)
if (c.GetType()==typeof (System.Windows.Forms.Label )
this.panel1.Controls.Remove (c);
It work for label control. But it not work for my abstract controls
Error is "object reference is not set to an instance of an object
How to slove that kinds of problem? please show me the way
Thanks in Advanced
I have one panel. It have 2 labels control and one abstract class control. In one event
I want to remove all labels control from that panel.
So I use this way.
foreach (Control c in this.panel1.Controls)
if (c.GetType()==typeof (System.Windows.Forms.Label )
this.panel1.Controls.Remove (c);
It work for label control. But it not work for my abstract controls
Error is "object reference is not set to an instance of an object
How to slove that kinds of problem? please show me the way
Thanks in Advanced