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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:35:24+00:00 2026-05-14T05:35:24+00:00

In my application I have methods which returns a control (checkbox, radiobutton, textbox) but

  • 0

In my application I have methods which returns a control (checkbox, radiobutton, textbox) but I want to use the same class for my webform and winform. How can I achieve this? I was thinking about an interface, but I don’t know how to implement this.

In my code I have the following methods:

public TextBox GenerateTextfield(AnswerPossibility answerPossibility)
{
    TextBox textBox = new TextBox();
    textBox.Tag = answerPossibility.Tag;

    return textBox;
}

public Collection<ButtonBase> GenerateMultipleChoice(Collection<AnswerPossibility> answers)
{
    Collection<ButtonBase> checks = new Collection<ButtonBase>();

    foreach (AnswerPossibility a in answers)
    {
        CheckBox chk = new CheckBox();
        chk.Text = a.Text;
        chk.Name = "chk" + a.Id.ToString();
        chk.Tag = a.Tag;

        checks.Add(chk);
    }

    return checks;
}

How can I make this so, that I can use this methods in a win form as well in a web form?

  • 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-14T05:35:25+00:00Added an answer on May 14, 2026 at 5:35 am

    The Winforms and Webforms UI structure is totally different from each other. The Web is a disconnected architecture, where you post back the results from the screen. With Winforms you have total control over every keystroke, within your application. You can achieve the same on the Web, but only through JavaScript, in a disconnected environment.

    Although the control class names look the same, they are from a different part in the namespace.

    If you really need you app to run the same on the web and local, you should go for Silverlight. This can run in & outside the browser, with the same code. Although you could limit your possible userbase.

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

Sidebar

Related Questions

I have an application that is database intensive. Most of the applications methods are
I'm trying to test a method I have in my application, but I don't
I'm converting an application to use Java 1.5 and have found the following method:
I have an game application I have written for Windows Mobile and I want
We have a Hibernate/Spring application that have the following Spring beans: <bean id=transactionManager class=org.springframework.orm.hibernate3.HibernateTransactionManager
In my application I have TextBox in a FormView bound to a LinqDataSource like
In my application I have a DataGridView control that displays data for the selected
I have a few before filters which I am using to control access to
I have a WCF client which passes Self-Tracking Entities to a WPF application built
I have an application with one form in it, and on the Load method

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.