473,657 Members | 2,394 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WhiteSpaces & Strings

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
1 1765
"=?Utf-8?B?RGF2ZQ==?=" <Da**@discussio ns.microsoft.co m> wrote in
news:22******** *************** ***********@mic rosoft.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6482
by: Edward K. Ream | last post by:
Am I reading pep 277 correctly? On Windows NT/XP, should filenames always be converted to Unicode using the mbcs encoding? For example, myFile = unicode(__file__, "mbcs", "strict") This seems to work, and I'm wondering whether there are any other details to consider. My experiments with Idle for Python 2.2 indicate that os.path.join doesn't work as I expect when one of the args is a Unicode string. Everything
0
1311
by: Prawdziwa Blondynka | last post by:
Hi, I would like to do the following with C++ and Xerces: set the schema path in an XML file to parse in this way: XMLCh* schemaLocation = XMLString::transcode(namespaceAndPath); //namespaceAndPath stands for the namespace and schema path containing whitespaces parser->setProperty(XMLUni::fgXercesSchemaExternalSchemaLocation,
4
6059
by: webdev | last post by:
lo all, some of the questions i'll ask below have most certainly been discussed already, i just hope someone's kind enough to answer them again to help me out.. so i started a python 2.3 script that grabs some web pages from the web, regex parse the data and stores it localy to xml file for further use.. at first i had no problem using python minidom and everything concerning
1
3965
by: st | last post by:
Hi, I'm using xmlDocument.Save(xmlTextWriter) to create an Excel-readable file. All works well, except where I've replaced the carriage return chars in the .innertext to XML-compliant " "; It gets changed to "&amp;#10" and doesn't render new lines in the Excel sheet. Can anyone help? Many thanks,
1
1697
by: rj | last post by:
Hello, I try to remove whitespaces from a string using the preg_replace function like preg_replace("/*/"," ",$string); This works great, but makes no handles all characters in the same way. I want to preserve data between double quotes. So, hello world "It is a sunny... world"
6
3683
by: mardif | last post by:
Hi guys. I've a very big big big problem: I've in my windows computer a file named cicciobello.html, located in c:\documents and settings\username\desktop\cicciobello.html. Now, I MUST open this file with os.spawn(os.P_WAIT ...., because I must wait the user cancel the explorer window, ok? And so, I write:
6
2104
by: mathieu.malaterre | last post by:
Hello, I cannot figure out a way to find a regular expression that would match one and only one of these two strings: s1 = ' how are you' s2 = ' hello world how are you' All I could come up with was: patt = re.compile('^*(+)+(+)$')
2
1679
by: rn5a | last post by:
When a Button is clicked in a Form, the JavaScript 'prompt' dialog pops-up for users to enter any text. When the user clicks OK in the prompt dialog, the text is populated in a TextBox & the Form posts. I then retrieve the text using Request.Form. The problem I am facing is in retaining whitespaces in the text the user has entered. Assume that the user has entered the following text in the JavaScript prompt dialog (note the whitespaces...
5
2321
by: mishink7 | last post by:
i was wondering how would u remove multiple whitespaces from the middle of a string to make it only one white space...for example: string hi= "hi bye"; then remove the multiple whitespaces in middle to make it "hi bye" any help would be appreciated...thanks.
0
8413
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7352
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.