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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:12:44+00:00 2026-05-17T19:12:44+00:00

Using WinForms I am coding a Component user control where I would like it

  • 0

Using WinForms I am coding a Component user control where I would like it to be able to display a designer editor form where I could see the list of all the controls names on the form where the component is located.

I got the basic mechanics of the component user control and the support of the designer editor. My question is not about that.

Let’s say I have a form where, in the IDE, I place the component in the component tray and several other controls on the form. Now, I invoke the designer editor for the component and I display the list of controls names.

Here’s a snippet of code:

internal class MyComponentEditor : UITypeEditor
{
    public override object EditValue
    (
        ITypeDescriptorContext context,
        IServiceProvider provider, object value
    )
    {
        var instance = context.Instance as MyComponent;
        var container = instance.Container;
        var controls = container.Components.Cast<Control>;
        var names = controls.Select (x => x.Name);
    }
}

Here, the names variable should contain the names of all the controls but I only get the type name!

Must be something obvious… 😉

  • 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-17T19:12:45+00:00Added an answer on May 17, 2026 at 7:12 pm

    Ok, I’ve nailed it.

    You need to do the following to get the name of the control, for each control:

    (string)TypeDescriptor.GetProperties (control)["Name"].GetValue (control)
    

    From my example:

    var names = controls.Select (x => (string)TypeDescriptor
                                          .GetProperties(x)["Name"]
                                          .GetValue(x));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a winforms webbrowser control to display some content in a windows forms
I am using VB.Net WinForms. I would like to call the Adobe Reader 9
I'm using a custom winforms 2.0 designer (i.e. my apps hosting the designer) which
i am using winforms with visual studio 2008. i would to create an EXACT
(Using WinForms and C#. -> .Net 2.0) I am adding nodes to a TreeView
I've been using Winforms since .NET 1.1 and I want to start learning WPF.
Consider a normal customer-orders application based on MVC pattern using WinForms. The view part
I am looking at building a client server application in C# using winforms or
I'm using C# WinForms to create a level builder for my XNA game. I
We have some corporate intranet users using a WinForms app to work on a

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.