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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:18:33+00:00 2026-06-09T07:18:33+00:00

I have a form in C# with a drop down box. When that drop

  • 0

I have a form in C# with a drop down box. When that drop down box gets changed, I want it to load a custom user control into a panel. I get no compile errors, no runtime errors, but I also get no visible user control. The idea here is that each user control understands the configuration for a different scenario. I want to encapsulate each scenario in its own control and the drop down box allows the user to select the scenario, which loads the control for the user to perform configuration. By adjusting the options in the drop down, I can customize what scenarios a given customer has. As I said, my problem is I cannot get any of the controls to become visible. This is the code I am using for the drop down index change event handler:

private void ddlCollectorType_SelectedIndexChanged (object sender, EventArgs e)
{
    m_currentControl = null;
    pnlDeviceConfig.Controls.Clear ();

    switch ((string) ddlCollectorType.SelectedItem)
    {
        case "SEL-421":
            SEL421ASCIIControl s421 = new SEL421ASCIIControl (this);
            m_currentControl = s421;
            pnlDeviceConfig.Controls.Add (s421);
            break;
        case "SEL-421 (FTP)":
            break;
        case "GE D60":
            GED6061850Control geD60 = new GED6061850Control (this);
            m_currentControl = geD60;
            pnlDeviceConfig.Controls.Add (geD60);
            break;
        case "GE D60 (TFTP)":
            break;
        case "MiCOM P442":
            break;
    }
}

I’ve only created a couple of the user controls so far, hence the empty case statements. When I make selections that should show me something, I get nothing (confirmed in the debugger that I am hitting the case statement body). Any help will be greatly appreciated!

  • 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-06-09T07:18:35+00:00Added an answer on June 9, 2026 at 7:18 am

    To follow up on my comment, I’m guessing that the position and/or dimensions of your control are not set.

    Try something like:

    ...
    SEL421ASCIIControl s421 = new SEL421ASCIIControl (this);
    m_currentControl = s421;
    pnlDeviceConfig.Controls.Add (s421);
    
    // TODO: Set real size and position.
    s421.Left = 0;
    s421.Top = 0;
    s421.Width = 100;
    s421.Height = 50;
    
    break;
    ...
    

    You also may use the Dock and Anchor properties of your control.

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

Sidebar

Related Questions

I have a continuous form that contains a drop down box whos control source
i have a form that has a multiple select drop down. a user can
We have an entry form that gives the user a calendar drop down, but
I have a form drop down box (for the 50 states) that is populated
I have a drop down box on my Django form that contains the ®
Say I have a form that contains a drop-down list populated by values stored
In my application I have a drop-down form that fires up an AJAX request
I have got a form into which information is entered, and a drop down
Lets say that I have a drop down list that I want to create
I have a list of Payees in a drop down box on my form.

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.