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

There is one thing that I do not understand... Imagine you have a text
I have a solid understanding of most OOP theory but the one thing that
I have fresh Rails 2.2 install, thing is that everything work fine until I
I have read that using database keys in a URL is a bad thing
I have a loader.exe with Main() that loads the 'UI' in WPF, the thing
it's a really weird thing - i have a website that works perfectly in
I have a model, Thing, that has a has_many with ThingPhoto, using Paperclip to
Lots of people have things that their systems do for them or for their
It's one of those things that seems to have an odd curve where the
I have a few things that I cannot find a good way to perform

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.