format double into string

  • Thread starter Thread starter Boni
  • Start date Start date
B

Boni

Hi all,
I am sure there is a simple way to get from double a formated string (but I
don't know it :).
D as double=2.687687649768976
Resulting string should be 2.688
Thanks in advance for your help,
Boni
 
Try

Imports System.Math

Dim D,E as double
Dim Result as String

D=2.687687649768976
E = Round(D,3)
Result = E.ToString

HTH, Phil
 
Boni said:
I am sure there is a simple way to get from double a formated string (but
I don't know it :).
D as double=2.687687649768976
Resulting string should be 2.688

\\\
MsgBox(d.ToString("F3"))
///
 
Dim D As Double = 2.6876876497689759

'Resulting string should be 2.688

Dim S As String

S = CType(System.Math.Round(D, 3), String)

MessageBox.Show("S: " & S)

Wayne
 

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