473,435 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,435 software developers and data experts.

iValue.ToString("###########0",CultureInfo::Curren tUICulture));

A question: (C#, C++)

If I use iValue.ToString("000000000000",CultureInfo::Curren tUICulture));
The I get a string with a fixed lengt if format: "000000542663"

But since I want the leading "0" gone, but still have the fixed string
length I replaced it with this:
iValue.ToString("###########0",CultureInfo::Curren tUICulture));

But to my suprise I get "542663" while I expected : " 542663" (note the
missing spaces)

Can someone tell me how to keep these leading spaces fixed because I need
them to create a grid of numbers as text output.
I cannot find it in the documentation.

---
http://www.skyscan.be
Nov 16 '05 #1
2 3747
Try
iValue.ToString().PadLeft(12, ' ');

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Olaf Baeyens" <ol**********@skyscan.be> wrote in message
news:41***********************@news.skynet.be...
A question: (C#, C++)

If I use iValue.ToString("000000000000",CultureInfo::Curren tUICulture));
The I get a string with a fixed lengt if format: "000000542663"

But since I want the leading "0" gone, but still have the fixed string
length I replaced it with this:
iValue.ToString("###########0",CultureInfo::Curren tUICulture));

But to my suprise I get "542663" while I expected : " 542663" (note
the
missing spaces)

Can someone tell me how to keep these leading spaces fixed because I need
them to create a grid of numbers as text output.
I cannot find it in the documentation.

---
http://www.skyscan.be

Nov 16 '05 #2
> Try
iValue.ToString().PadLeft(12, ' ');


Nice. :-)
--
http://www.skyscan.be
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: sfdgkjhldsfg | last post by:
Hi, This is driving me nuts, hopefully someone here can put me out of my misery. I'm generating a web page with drop down combo boxes, and I want one of the values to be automatically...
6
by: Gerry Abbott | last post by:
Hi all, Have written some code to limit the concurrent users of a database. Use the Autoexec macro to open a form. When the form opens it increments a value in a table. When the form closes...
4
by: Mark Hollander | last post by:
Hi, Is there an easier way to convert a UInt16 to Int16 than the way I am currently doing it Dim iValue As Int16 Dim uValue As UInt16 Try uValue = GetValue(WMI.NetworkAdapter,...
6
by: Col | last post by:
Hi - I've never worked with list boxes before. Here's what I'd like to do - have a list box (or some other control) that allows multiple selection and stores all the values in one field (can be...
2
by: Harry Strybos | last post by:
Hi All I have a form with about 20 check boxes and I want to persist their state to a single integer. That is to say, I want to set their Checked property to a particular bit value contained in...
23
by: Jonathan Wood | last post by:
I was wondering if some of you could advise me on the following issue. I ported my code that generates shareware licenses to a C# class. I'd like to get to the point where this is done online...
1
by: Smalley | last post by:
Need some help please. Have this code and for some reason it is not working correctly. I am not receiving errors, just the table is not being populated at all. I have created the tbl and the frm...
2
by: VictorTan | last post by:
Hello. I'm new to this forum. Hope that I don't make mistakes in here but if I do, please correct me if there is. Thanks. I also wanted to ask you guys regarding about the following following...
21
by: Christian Meier | last post by:
Hello NG I have the following code: file1.h: static const int iValue = 5; <EOF>
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.