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

  • Home
  • SEARCH
  • 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 7031579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:49:19+00:00 2026-05-28T00:49:19+00:00

I am creating a generic Windows Form that accepts T and uses reflection with

  • 0

I am creating a generic Windows Form that accepts T and uses reflection with custom attributes to create labels and input controls at run-time.

Example:

class GenericForm<T>: Form where T : ICloneable<T>  
{  
}  

Here’s a link to a previous question for the form code: SO Question.

This form could accept the following entity class as an example:

class Vehicle: ICloneable<Vehicle>  
{  
    public int Id { get; set; }  
    public int Name { get; set; }  
    public int Description { get; set; }  
}  

As you could imagine, the magic behind the form would use reflection to determine data types, validation criteria, preferred control types to use, etc.

Rather than re-inventing the wheel, I thought it would be worth asking on SO if anyone knows of such frameworks. Needless to say, I’m looking for something simple rather than a bulky framework.

  • 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-28T00:49:20+00:00Added an answer on May 28, 2026 at 12:49 am

    As far as I know, there are no frameworks that generate the UI code at runtime. There are plenty of tools (code-generators) that do this before. But you wouldn’t have the advantage of “only” changing the code – you’d had an extra step where you would need to start the code generator.

    If you really want to create the UI information at runtime – I’d generate Attributes for your properties, that would tell your UI generator how to deal with this property (if no Attribute is given – have a default for your datatypes). It’s a lot of coding but could save you time for small to medium projects in the future.

    Another thing you could do is to externalize your UI information into an XML file and have a generator for that one. There’s actually a framework that does that – have a look at the re-motion framework. I don’t know if the part of the UI is free but it has some functionality (i.e. mixins) that could help you fulfilling your task.

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

Sidebar

Related Questions

Possible Duplicate: Update label location in C#? I am creating a custom windows form
I am looking into creating type-safe generic controls. This is targeting the (reduced) generics
I'm creating a class named TetraQueue that inherits System.Collections.Generic.Queue class overriding the Dequeue method,
I'm creating a generic list class that has a member of type Array(Array of
I'm creating a custom generic class for an assignment in school. I'm stuck at
I am creating a custom button that shows slightly faded text normally, and full-strength
for that past couple of weeks I have been creating generic script that is
I am in the middle of creating some generic class. And I create three
I'm creating a generic reusable UIViewController component that people can add to their applications.
I am creating a generic XML to SQL Server data driver (In c#), that

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.