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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:58:40+00:00 2026-05-13T06:58:40+00:00

I have a Form and a UserControl. The UserControl has a menu, and the

  • 0

I have a Form and a UserControl. The UserControl has a menu, and the form has a tabstrip (General, Food, Vitamins etc).

In the UserControl, I have the following code: (Form name is frmForm, the tab names in the form are tabGeneral,tabFood, tabVitamins)

  frmForm fm=new frmForm();
  fm.tabMain.Selected=tabVitamins;

I call these line from the UserControl to capture the tab to get selected on the form, but it does not select the vitamins tab.

Where am I going wrong? I have access specifier as Protected Internal for tabs in the form.

Please advice.

Thanks,
Karthick

  • 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-13T06:58:40+00:00Added an answer on May 13, 2026 at 6:58 am

    When you write new frmForm(), you’re creating a completely new instance of frmForm, which is then discarded.

    To get the frmForm instance that holds your control, call the FindForm() method and cast to frmForm.

    For example:

    frmForm myForm = FindForm() as frmForm; 
    if(myForm != null)
        myForm.tabMain.SelectedTab = myForm.tabVitamins;
    

    If the control is on some other form, this code won’t do anything.


    By the way, Hungarian notation is frowned upon in .Net.
    Your form should probably be named something like MainForm.

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

Sidebar

Related Questions

I have looked at the generated designer code of Form s and UserControl s,
I have an application with main form. the main form has menu and some
I have WinForms application. My Form derived class has UserControl derived class. I simply
I have form containing a Clear Button, usercontrol. The userControl has some text box
I have an ASP.NET web form that has a container usercontrol that hosts several
I have a user control contained in a tabpage. The Form has set AutoScaleMode
i have a simple usercontrol with following properties: public partial class RichTextEditorControl : UserControl
I have problem with my UserControl. It has inside the UpdatePanel, but it must
I have a UserControl with something that does some background work. When thing has
I have a user control which has several radiobuttons and buttons... I have code

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.