By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,474 Members | 3,141 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,474 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Nov 15 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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.

--
The hotmail account will most likely not be read, so please respond only
to the news group.
Nov 15 '05 #2

P: n/a
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

"Morten Wennevik" <Mo************@hotmail.com> wrote in message news:op**************@msnews.microsoft.com...
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.

--
The hotmail account will most likely not be read, so please respond only
to the news group.

Nov 15 '05 #3

P: n/a
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.

--
The hotmail account will most likely not be read, so please respond only
to the news group.
Nov 15 '05 #4

P: n/a
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

"Morten Wennevik" <Mo************@hotmail.com> wrote in message news:op**************@msnews.microsoft.com...
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.

--
The hotmail account will most likely not be read, so please respond only
to the news group.

Nov 15 '05 #5

P: n/a
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 :)

--
The hotmail account will most likely not be read, so please respond only
to the news group.
Nov 15 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.