Formated string or double?

  • Thread starter Thread starter bojan.pikl
  • Start date Start date
B

bojan.pikl

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
 
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);
 
cody said:
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.
 
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)


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
 
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.
 
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")
 
Hmm, I don't want exponental form (like 2,345E3) and I don't want fixed
number od decimals.

Is this possible?
 
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

--
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top