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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:57:09+00:00 2026-05-26T22:57:09+00:00

Possible Duplicate: Text property in a UserControl in C# How do I mark the

  • 0

Possible Duplicate:
Text property in a UserControl in C#

How do I mark the Text property of a UserControl as browsable?


A .NET UserControl class has a Text property.

Unfortunately the Text property of a UserControl isn’t browsable:

//
//
// Returns:
//     The text associated with this control.
[Bindable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public override string Text { get; set; }

In my UserControl I want to expose the Text property (i.e. make it “browsable“) in the properties window. I tried blindly declaring it browsable:

[Browsable(true)]
public override string Text { get; set; }

and now it appears in the properties window, except now it does nothing.

I tried blindly calling base.Text to bring back the functionality:

[Browsable(true)]
public override string Text { get {return base.Text;} set { base.Text = value; this.Invalidate(); } }

and now the property does function at design-time, but the property value is not persisted to the Form.Designer.cs and it’s InitalizeComponent code.

What is the proper way to expose the UserControl Text property so that it:

  • is browsable in the properties window
  • is functional
  • is persisted in the form designer

and, as a bonus:

  • know when it changes
  • 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-26T22:57:10+00:00Added an answer on May 26, 2026 at 10:57 pm

    You’re on the right track; just add [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]

    To find out when it changes, override OnTextChanged:

    protected override void OnTextChanged (EventArgs eventArgs)
    {
        System.Diagnostics.Trace.WriteLine("OnTextChanged(): eventArgs: " + eventArgs);  
        base.OnTextChanged(eventArgs);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Is there any way to determine text direction from CultureInfo in asp.net?
Possible Duplicate: Text on an Image button in c# asp.net 3.5 I want a
Possible Duplicate: How do I get this CSS text-decoration override to work? Take a
Possible Duplicate: Client Id for Property (ASP.Net MVC) Is there a way to make
Possible Duplicate: Multiline text in JLabel I want to do this: JLabel myLabel =
Possible Duplicate: How do I ensure a text box is alphanumeric but without a
Possible Duplicate: How to remove border around text/input boxes? (Chrome) Is there a way
Possible Duplicate: How do I calculate someone's age in C#? Maybe this could be
Possible Duplicate: .NET - What’s the best way to implement a catch all exceptions
Possible Duplicate: Parsing text in C Say I have written to a text file

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.