473,387 Members | 1,766 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,387 software developers and data experts.

Formated string or double?

Hi, I am making a calculator. I have a double wich I am parsing to
string and writing to label. How could I make that double or string
would be only 14 length + space for negative sign (-).
So I need formated double or String.

Thanks for all your help,
stric

Jun 28 '06 #1
7 1614
bo********@gmail.com wrote:
Hi, I am making a calculator. I have a double wich I am parsing to
string and writing to label. How could I make that double or string
would be only 14 length + space for negative sign (-).
So I need formated double or String.

Thanks for all your help,
stric


label.Text = result.ToString().SubString(0, 14);
Jun 28 '06 #2

cody wrote:
bo********@gmail.com wrote:
Hi, I am making a calculator. I have a double wich I am parsing to
string and writing to label. How could I make that double or string
would be only 14 length + space for negative sign (-).
So I need formated double or String.

Thanks for all your help,
stric


label.Text = result.ToString().SubString(0, 14);


Hmm, the problem is that this will just cut the last numbers off, and
the result will probably be wrong. It should be more like to round the
number on 14 long.

Jun 28 '06 #3
Just limit the number of chars typed in your control by regexp on counting
items in KeyPress (take into acoount that in could be set via clipboard)
"bo********@gmail.com" wrote:

cody wrote:
bo********@gmail.com wrote:
Hi, I am making a calculator. I have a double wich I am parsing to
string and writing to label. How could I make that double or string
would be only 14 length + space for negative sign (-).
So I need formated double or String.

Thanks for all your help,
stric


label.Text = result.ToString().SubString(0, 14);


Hmm, the problem is that this will just cut the last numbers off, and
the result will probably be wrong. It should be more like to round the
number on 14 long.


--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jun 28 '06 #4
Hmm, could you tell me more about that. I can't find anything about
regexp in C#. And what about when I comput the result it may become
larger number than that.

Michael Nemtsev wrote:
Just limit the number of chars typed in your control by regexp on counting
items in KeyPress (take into acoount that in could be set via clipboard)
"bo********@gmail.com" wrote:

cody wrote:
bo********@gmail.com wrote:
> Hi, I am making a calculator. I have a double wich I am parsing to
> string and writing to label. How could I make that double or string
> would be only 14 length + space for negative sign (-).
> So I need formated double or String.
>
> Thanks for all your help,
> stric
>

label.Text = result.ToString().SubString(0, 14);


Hmm, the problem is that this will just cut the last numbers off, and
the result will probably be wrong. It should be more like to round the
number on 14 long.


--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche


Jun 28 '06 #5

<bo********@gmail.com> wrote in message
news:11*********************@j72g2000cwa.googlegro ups.com...
Hi, I am making a calculator. I have a double wich I am parsing to
string and writing to label. How could I make that double or string
would be only 14 length + space for negative sign (-).
So I need formated double or String.

Thanks for all your help,
stric


For example:

double num;
num.ToString("0.00000000E+000")
Jun 28 '06 #6
Hmm, I don't want exponental form (like 2,345E3) and I don't want fixed
number od decimals.

Is this possible?

Jun 28 '06 #7
> Hmm, could you tell me more about that. I can't find anything about
regexp in C#. See Regex Class.
And what about when I comput the result it may become
larger number than that.
use E presentation type, like 1,516152204327655388625240552138e+62
Michael Nemtsev wrote:
Just limit the number of chars typed in your control by regexp on counting
items in KeyPress (take into acoount that in could be set via clipboard)
"bo********@gmail.com" wrote:

cody wrote:
> bo********@gmail.com wrote:
> > Hi, I am making a calculator. I have a double wich I am parsing to
> > string and writing to label. How could I make that double or string
> > would be only 14 length + space for negative sign (-).
> > So I need formated double or String.
> >
> > Thanks for all your help,
> > stric
> >
>
> label.Text = result.ToString().SubString(0, 14);

Hmm, the problem is that this will just cut the last numbers off, and
the result will probably be wrong. It should be more like to round the
number on 14 long.


--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Jun 29 '06 #8

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

Similar topics

2
by: Pat Brown | last post by:
I am pulling an integer value of the amount of seconds since 12:00 am from a SQL Server DB. I want to convert this integer into a formated string or datetime to display a legible time of day. Are...
0
southoz
by: southoz | last post by:
Good ay all , I'm fairly new to access(a little over 5 weeks now). Since I'v started I have picked up a lot of useful information from forums such as this and in doing so will share that information...
13
by: so many sites so little time | last post by:
say i want spacing in my text so instead of doing <br> <br> in between the lines or having to do <href = or <a href = for a link what could i do to have php enter to mysql or retrive it formated?
6
by: cthoes | last post by:
following program does the display of student details but i want to search for the particular student name from the added list of student. so it would be great any one can help me without using...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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...

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.