hi all!

i have a table layout panel with lots of controls in it.
side to it i have a combobox with 5 options "system A" and "system B" ect.

when i pick one system, i clear all the controls one by one (checkboxes to check=falsa , textboxes.text = "" ect. ), then i put visible = false to the controls i dont need and visible = true to those who were false .

is there a way to completely clear the table layout panel and then recreate it with the appropriate controls (something like initialiseComponents) ?

i've tried dispose but then when i use the creatcontrol method i get "canot access a disposed object".


thanks,
Zvika

What do you mean by Clear the table layout? to reset all controls value i.e all textboxs Text property = null or to set the visibility = false
You can access all TableLayoutPanel controls by tableLayoutPanel1.Controls

I mean I want to have the table with the controls in it - fresh like i got it when i first loaded the program (all check boxes unchecked all text boxes empty )

foreach(Control c in tableLayoutPanel1.Controls)
{
if( c is TextBox)
c.Text = null;
else if (c is CheckBox)
c.Checked = false;
else
//.....
}

thanks a lot

but it tells me i cant write c.checked identifier expected
apparently it deos not recognize the control as checkbox
do i need some kind of casting ?

This question has already been answered. Start a new discussion instead.