Hiding/blocking tabs using windows forms in c#
Posted
by Audel
on Stack Overflow
See other posts from Stack Overflow
or by Audel
Published on 2010-04-26T12:52:48Z
Indexed on
2010/04/26
13:03 UTC
Read the original article
Hit count: 291
The thing is that i have a 'log in window' and a 'mainwindow' that is called after pressing the log in button or the "VISITANT" button
If pressing the log in button, the whole system will come out, and if i press the VISITANT button, one tab should disappear or be blocked or something.
private void visitant(object sender, EventArgs e)
{
mainwindow menu = new mainwindow();
menu.Show();
//mainwindow.tabPage1.Enabled = false; //attempt1
//mainwindow.tabPage1.Visible = false; //attempt1
//System.Windows.Forms.tabPage1.Enabled = false;//attempt2
//System.Windows.Forms.tabPage1.Visible = false;//attempt2
this.Hide();
}
the errors i get for using the attempt1 are
Error 1 'System.mainwindow.tabPage1' is inaccessible due to its protection level'
Error 2 An object reference is required for the non-static field, method, or property 'System.mainwindow.tabPage1'
and the one i get for using the attempt2 is
Error 1 The type or namespace name 'tabPage1' does not exist in the namespace 'System.Windows.Forms' (are you missing an assembly reference?)
as you probably have guessed "tabPage1" is the tab i need to hide when pressing the visitant button.
I can't think of any more details, I will be around to provide any extra information
Thanks in advance.
© Stack Overflow or respective owner