A simpler way to prevent numbers from showing in the exponent

I will rely on the saying that the question is not a stupid question, but I have a slightly stupid question.

EDIT:

It seems that this question has been asked and already answered this several times, although I did not come across using headers when searching for duplicates. Here are some related posts:


The original question:

I have an application that sometimes stores several decent numbers, for example 0.000023425. These numbers are loaded into the controls TextBoxfor user editing. The following contrived example shows my problem:

Dim number As Double = 0.000023425
someTextBox.Text = number.ToString() ' Shows "2.3425E-05"

As already mentioned, the text that shows is 2.3425E-05that it’s not very intuitive for the user, plus I have the numbers even more accurate (up to 19 decimal places). I would like the result to be fixed. Of course, I could easily and cleanly do:

number.ToString("F20") ' Shows "0.00002342500000000000"

But then an annoying number of zeros remained. Therefore, to fix this, I could do:

number.ToString("#,##0.####################") ' Shows "0.000023425"

, , , ​​ ? , , , , , , ? - , , , .

!

UPDATE

, . , Decimal .

Dim number As Decimal = 0.000023425
someTextBox.Text = number.ToString() ' Shows "0.000023425" instead of "2.3425E-05"

, , Double , ?

I ( ), , .ToString() , . , ? , Decimal , Double ( ), , , #,##0.#################... .

+3
1

( ) . (.. , ).

( ) , , .

... , .

- , "" "", . , .

+3

Source: https://habr.com/ru/post/1720722/


All Articles