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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:30:14+00:00 2026-06-03T01:30:14+00:00

I created this User Control: I added that User Control to the main Form

  • 0

I created this User Control:

enter image description here

I added that User Control to the main Form and now I want to customize it.
So I will have to add text to those 3 Buttons, text in Label, populate ListBox and setting Click Events for the buttons.

What is the proper way to do that?

I looked around on the web and apparently the way to do it is to add public properties in user control that would expose individual property of control that I need.

Something like:

    public string Button1Text
    {
        get
        {
            return btn1.Text;
        }
        set
        {
            btn1.Text = value;
        }
    }

If I go this route, I would have to add quite a few public properties to this simple user control.

But isnt it easier just to expose whole control in user control like this?

    public Button MyButton1
    {
        get { return this.btn1; }
        set { this.btn1 = value; }
    }

That way the Main Form can simply access control and its properties as they are needed.

  • 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-03T01:30:16+00:00Added an answer on June 3, 2026 at 1:30 am

    First method is better from the perspective of encapsulation. Second method causes users (forms) of your control to depend on the view of your control, and this prevents changes to the view in the future.

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

Sidebar

Related Questions

I have a costom user control that I have created. I want to add
I have a custom ASP.NET user control that is added to a panel on
I am looking to create a user/server control that will be created with something
I have created a User Control in my application that has a textbox and
I have an ObservableCollection that is created in user control that contains a custom
i created rectangle shape user control and i am using this user control in
I just created a user control. This control also makes use of my static
I'm trying to get every ID from a list that a user created. This
I have created a web user control called Activity. I have defined a public-facing
I have created a custom user control, which is basicly a ItemsControl with it's

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.