S
Safiiru no Baka
Hi I'm having issues removing controls on the fly. Here's my code:
=================================================================
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
for(int i = 0; i < this.Controls.Count; i++)
{
System.Windows.Forms.Control tempText;
tempText = this.Controls;
if(tempText is System.Windows.Forms.TextBox)
{
this.Controls.Remove(tempText);
tempText.Dispose();
}
}
//
// TODO: Add any constructor code after InitializeComponent call
//
}
=================================================================
It is working somewhat, some text boxes are removed while some are not.
I tried directly using the "this.Controls" handle but that behaves
the same way, except different fields are left behind.
Thanks in advance.
=================================================================
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
for(int i = 0; i < this.Controls.Count; i++)
{
System.Windows.Forms.Control tempText;
tempText = this.Controls;
if(tempText is System.Windows.Forms.TextBox)
{
this.Controls.Remove(tempText);
tempText.Dispose();
}
}
//
// TODO: Add any constructor code after InitializeComponent call
//
}
=================================================================
It is working somewhat, some text boxes are removed while some are not.
I tried directly using the "this.Controls" handle but that behaves
the same way, except different fields are left behind.
Thanks in advance.