Hide a Treeview

  • Thread starter Alistair George
  • Start date
A

Alistair George

Hi.
This is very odd see the code below, it runs through it UNTIL the
condition is set, and what happens then is the treeview (tvNodes) is no
longer active, but is visible. Never once is the Visible property set
false. Any takers?


private void tvNodes_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
tvNodes.Visible=!(tabControl1.SelectedIndex == 2);
 
A

Alistair George

Alistair said:
Hi.
This is very odd see the code below, it runs through it UNTIL the
condition is set, and what happens then is the treeview (tvNodes) is no
longer active, but is visible. Never once is the Visible property set
false. Any takers?


private void tvNodes_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
tvNodes.Visible=!(tabControl1.SelectedIndex == 2);
Changed the event fixed the issue as below:
private void tabControl1_SelectedIndexChanged(object sender,
EventArgs e)
{
tvNodes.Visible = !(tabControl1.SelectedIndex == 2);
}
 

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