Solved

Visual Studio 2010 - Looking for a margin inside Textbox

Posted on 2012-03-14
2
2,557 Views
Last Modified: 2012-03-15
I've got a form with a textbox in it and the text butts right up against the border. It looks very unprofessional but I can't figure out a way to add padding on the left or right.

Screenshot. Note the text right up against the border.
I see the Margin property, but I've tried changing it from the default of 3 all the way up to 25 with no affect. But, the HELP seems to suggest Margin is space BETWEEN controls, not for the text within it.

The textbox is docked, but that shouldn't matter.

How can I show a little space on the left and right?
0
Comment
Question by:Kaprice
2 Comments
 
LVL 3

Accepted Solution

by:
zofcentr earned 500 total points
ID: 37723808
There is property like padding for controls which sets this what you want.
Unfortunately for textbox like controls it is not used by Winforms framework.
Details here:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.padding.aspx

There is probably more then one workarounds like below one.

Create panel with border and color like your Textbox.
Set padding of this panel and insert textbox into the panel
Set textbox border to none.

Hope this will help
0
 

Author Closing Comment

by:Kaprice
ID: 37723984
I'm shocked and disappointed that MS neglected the very obvious and valuable property of text margin for textboxes.

But, you've provided a very easy workaround. Thank you!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now