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 983087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:48:00+00:00 2026-05-16T04:48:00+00:00

I’ll start with this: I’m no good at C#. I don’t for the most

  • 0

I’ll start with this: I’m no good at C#. I don’t for the most part know what I’m doing.

Now the disclaimer is out the way, I’m trying to access a TabControl in my Interface (made using VS2008, so parts are in Interface.Designer) from another class – except using Interface.tabControl1 tells me i need an object reference, and if I type . after Interface I just get a list of stuff, not any of the objects within the interface. Using Interface.ControlCollection doesn’t help either.

Help is appreciated, and I’m sure this is really basic and I’m just a spanner, but oh well.

EDIT: in Program.cs (which i would guess was autocreated when I started building the app), the interface is created nameless:

    static void Main()
    {
        Application.Run(new Interface());
    }

Interface() is called from Interface.cs:

public partial class Interface : Form
{
    public Interface()
    {
        InitializeComponent();
    }
}

The rest of the partial class is created in Interface.Designer.cs – which was autogenerated when I was building the interface in the VS2008 designer.

I’m not sure if that helps, or is of no use. But there it is anyway. =)

EDIT #2:

I think i should explain what I’m doing, maybe then people will understand what I need out of this:

I had an interface, with a tabcontrol, and tabs generated on-the-fly based on whatever the user was doing. This was causing problems because i wasn’t making each tab its own object, so when it came to accessing stuff in the pages without affecting other tabs, it didn;t work. As such, i removed all the code from a method in Interface.cs that was used to build a tab, and made a new class called Tab.cs – This is where the problem of broken references appeared. Relevant code, moved from Interface into Tab:

public Tab(string inputstring)
{
    .....
    //call this method if button is clicked
    cancel.Click += new System.EventHandler(this.close_Click);
    //ridiculous calculations to get the buttons in the right place
    int leftside = ((tabControl1.Width / 100) * 96);
    int bottomside = ((tabControl1.Height / 100) * 93);
    int bottomside2 = ((tabControl1.Height / 100) * 99);
    .....
    //call this method if button is clicked
    save.Click += new System.EventHandler(this.save_Click);
    .....
    //call this method when tab is entered
    newtab.Enter += new System.EventHandler(this.tabSelect);
}

Of particular relevance is the code with tabControl1.Width. This then leads back to what I started trying to ask about before.

I hope that maybe makes things clearer.

EDIT3: (for Henk Holterman) I’ve renamed Interface to MainForm. VS2008 decided it should be called interface, I simply didn’t change that. But I see why change is good, thank you =P

  • 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-16T04:48:01+00:00Added an answer on May 16, 2026 at 4:48 am

    tabControl1 is a control created in the Designer-part of your main form (in Interface.designer.cs). So tabControl1 refers to an instance field. You will have to give your Tab class in Tab.cs your instance of the main form (such as in the constructor) so you can then reference that. Also, you have to check that those fields are public/internal so you can access them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there's a lot of other questions out there that deal with this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't

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.