How do I add trailing spaces within a right-justified textBox?

  • Thread starter Thread starter Stan Shankman
  • Start date Start date
S

Stan Shankman

How do I add trailing spaces within a right-justified textBox?

In order to add a trailing space to the text in a right-justified textBox,
I use to just append a space to the end of the text string.
But now, textBox seems to have gotten smarter,
as it automatically remove trailing spaces.

So the question remains:

How now do I add trailing spaces to text inside a right-justified textBox?

Thanks all,

- Stan Shankman
 
Hi Stan,

What do you mean by right justified?
I am afraid I could not reproduce your problem.
I tried using a textbox with TextAlign.Right or RightToLeft.Yes, but both
seem to accept trailing spaces both to the front and behind.
 
Well, it doesn't work for me. Something has changed on me.
Maybe it's the way I actually try to add a space.

I do this:
textBox1.Text = "test" + " " ;

Do you see anything wrong with this?

- Stan Shankman
 
Sorry, for me that still adds the extra " " as expected.

textBox1.Text = "test" + " "; is the same as
textBox1.Text = "test ";
Other than it takes a splitsecond (nothing you could really meassure)
longer to assign since it has to be added up first.
 
Okay, I guess I had some confusion over the two textBox properties:

RightToLeft, and TextAlign

Once I get them both set correctly, things started working as before.
I am resurrecting some old code, and since I don't recall making any changes,
I was surprised to see discover that it wasn't working as it had been.

Is the RightToLeft property new to VS 2003?

Hey, and thanks for the serious effort you put in with your assistance.

Much appreciated,

- Stan Shankman
 
The RightToLeft property is for "reverse" writing style, like arabic,
where you write from right to left. Each new character is put to the
right of the last one (instead of the usual left).

I don't remember ever testing it in VS2002 but since .NET has focused on
global/localization I would be surprised if it wasn't there.

Glad to be of assistance :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top