The "Visible" property of a parent control ruins that one of its child controls

W

Wesam

Hi all,

I got a problem: I have a Panel control which has many mixed child controls
(buttons, checkboxes, comoboxes). All controls are visible (the parent
container Panel is also visible). My problem is that when I set the Visible
property of the Panel to false and try to read the Visible property of any
of its child control, the result is always false??? How can I get the
original value of the Visible property of any child control??

I'd appreciate your prompt reply,

Thanks a lot ..

Veszko

/****************************/

Panel pnl = new Panel();
..
..
..
pnl.Visible = true;

Button btn = new Button();
..
..
..
btn.Visible = true;

pnl.Controls.Add(btn);

..
..
..
MessageBox.Show(pnl.Visible.ToString()); // The result is "True"
MessageBox.Show(btn.Visible.ToString()); // The result is "True"

pnl.Visible = false;

MessageBox.Show(pnl.Visible.ToString()); // The result is "False"
MessageBox.Show(btn.Visible.ToString()); // The result is "False" ...
which is not OK!!!

// I need to know the original value of "btn.Visible"

/****************************/
 
M

Mike McClaran

I don't know for sure, but I suspect this is by design. Maybe someone from
Microsoft could confirm this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top