Click to See Complete Forum and Search --> : Number to string


regis
August 20th, 2001, 03:17 PM
Hi,
I would like to put 2.222545E-3 in string var.

I want "0.00222545" but I receive "2.222545E-3"

Somebody can help me?

Thanks
Redg

Kdev
August 20th, 2001, 03:49 PM
Dim dNum as Double
Dim sNum as string

sNum = "2.222545E-3"
dNum = sNum
sNum = dNum

MsgBox dNum



There should be a way to do this with the Format function but I could not get it to work with this sort of string constant. Here I just let VB do the conversion to a double and then back to a string to get the output that you requested.

-K

John G Duffy
August 20th, 2001, 07:20 PM
private Sub Command1_Click()
Dim sng as Single
sng = 0.00222545
MsgBox Format(sng, "0.####################")
End Sub




John G