Visual Basic - Decimales

Life is soft - evento anual de software empresarial
 
Vista:

Decimales

Publicado por chelo (46 intervenciones) el 12/11/2005 14:16:08
Amigos, tengo el siguiente conflicto en esta rutina:
Dim fs, X
Dim archivo As String
archivo = c & "\" & "decimales" & ".txt"
Set fs = CreateObject("Scripting.FileSystemObject")
Set X = fs.CreateTextFile(archivo, 1)
X.Close
Open archivo For Output As #1
Print #1, Str((Round(10.111, 2))); ",";
Print #1, Str((Round(22.1, 2))); ",";
Print #1, Str((Round(4.00001, 2)))
Close #1

Esta crea un archivo de texto y luego incerta valores en él.
El problema que tengo es que necesito que todos tengan la misma longitud, es decir que por ejemplo:

el Nº 10.111 sea redondeado a 10.11
el Nº 22.1 sea redondeado a 22.10
el Nº 4.00001sea redondeadoa 4.00

etc................

Agradecere sus ayudas
CHAO
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Decimales

Publicado por Ramón (90 intervenciones) el 12/11/2005 17:44:24
Cambia Str por Format$, así:
Print #1, Format$(10.111, "#,##0.00"); ",",
Print #1, Format$(22.1, "#,##0.00"); ",",
Print #1, Format$(4.00001, "#,##0.00")
Saludos.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar