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

WhiteSpaces & Strings

P: n/a
Hi

Have a method that builds and returns a of specfic accounting codes to a
datagrid textbox field.

eg, if a user types in "200" the method builds & returns the code "200.00.00".

also if a user types in "51" the method should return " 51.00.00" but I am
finding difficulty adding a white space infront of the string, I have been
using the PadLeft method eg: sCode = sCode.PadLeft(1, ' ') + ".00" + ".00";
but with no success.
Even if I add a whitespace to the Datagridtextbox it removes it.

So my question is, is it possible to add whitespaces infront of the string?
and
Is it possible to format the textbox so it can leading spaces?
If anyone has any examples that would be great.

thanks
Dave


Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"=?Utf-8?B?RGF2ZQ==?=" <Da**@discussions.microsoft.com> wrote in
news:22**********************************@microsof t.com:
Hi

Have a method that builds and returns a of specfic accounting
codes to a datagrid textbox field.

eg, if a user types in "200" the method builds & returns the
code "200.00.00".

also if a user types in "51" the method should return "
51.00.00" but I am finding difficulty adding a white space
infront of the string, I have been using the PadLeft method eg:
sCode = sCode.PadLeft(1, ' ') + ".00" + ".00"; but with no
success. Even if I add a whitespace to the Datagridtextbox it
removes it.

So my question is, is it possible to add whitespaces infront of
the string? and
Is it possible to format the textbox so it can leading spaces?
If anyone has any examples that would be great.


Dave,

If you want the first set of digits to be three characters wide, use
PadLeft(3, ' '). The "3" tells PadLeft the total width of the
string, not how many spaces it should add.

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.