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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:46:47+00:00 2026-06-09T12:46:47+00:00

I am writing a windows forms application that has a lot of textboxes. I

  • 0

I am writing a windows forms application that has a lot of textboxes. I want to add a label or a caption to the textbox, so that I don’t have to drag a lot labels onto the form and deal with positioning etc. So far I have found 2 possible ways to do this.

  1. Create a user control with the label and textbox. How do I get the
    control, label and textbox to size appropriately depending on the
    text entered since the control will be reusable and different text sizes will be entered. How to get all the
    properties and events of the textbox to remain the same.

  2. Extend a normal textbox and add a string property called label or
    caption, and show this property at the left of the textbox. I know
    this can be done in Web.UI with CSS but is it possible in a winform
    and how?

Any suggestions on how to do either of these?
Thanks.

  • 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-09T12:46:48+00:00Added an answer on June 9, 2026 at 12:46 pm

    You can create a UserControl that contains a label and a textbox. When you add the user control to your form, both the label and the textbox within will be added simultaneously. You can expose properties of the label and textbox to assign values at design or run time.

    Using this method, you can add multiples of the user control to standardize the layout. As far as resizing the controls based on the text, you’ll have to subscribe to events and change the sizing manually.

    For example, you can subscribe to the TextChanged event of the label and the textbox. When the event fires, you calculate the size of the string and then adjust the width and position of the controls accordingly.

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

Sidebar

Related Questions

I am writing a windows forms application that has a check box regarding the
I have written a Windows Forms application and now I want to write some
I have a form in a Windows form application that I want to display
I'm writing an Windows Forms application that reads a file, processes it and then
I'm writting a Windows Forms application in C# that executes a lot of long-running
I have a Windows Forms application that when the Main Window is closing, it
I'm writing a .NET Windows forms application that is to be used for importing
I have a form in a vb.net windows form application called PolicyRefreshStatus.vb that has
I am about to start on a journey writing a windows forms application that
I'm writing a simple Windows forms application to get me into the swing of

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.