Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 765645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:55:08+00:00 2026-05-14T16:55:08+00:00

The thing is that i have a ‘log in window’ and a ‘mainwindow’ that

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T16:55:09+00:00Added an answer on May 14, 2026 at 4:55 pm

    The controls you add to your form are, by default, not publicly visible. Your “attempt1” code would be the correct code, except for this detail.

    (EDIT: to fix it this way, change the “Modifiers” property of tabPage1 to be Public or Internal – this allows other classes to see those controls from outside the form.)

    However, a better approach than making these controls visible would be to create a new public method on your mainwindow class, something like this:

    public void HideTab()
    {
       tabPage1.Enabled = false;
       tabPage1.Visible = false;
    }
    

    Then, in your sample code, call your new method after you create/show the form:

     mainwindow menu = new mainwindow();
     menu.Show();
     menu.HideTab();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The thing is that I have a very large JS file, with more than
I don't know if the title is right. The thing is that I have
I have this thing that i need to do and some advices will be
So i have been creating this framework thing that basically puts together source code
I have a kind of strange thing that I really nead for my text
We have a number of servers running various different LAMP setups. One thing that
I have problem with php script. The thing is that it shows me, that
simple thing which I need to do is, that I have a pdf document
I have an application which uses the microsoft kinect device. The thing is that
I have a function which executes on click event, but the thing is that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.