Visual Basic Foro
Programación => Visual Basic 6 => Mensaje iniciado por: E N T E R en Agosto 12, 2011, 04:47:52 pm
-
Lo que quiero es dentro de esta funcion que permita formatear y que tambien pueda quitar el formato.
-
Public Function toMoney(ByVal srcCurr As String) As String
toMoney = Format(srcCurr, "##,###0")
End Function
Private Sub Text1_Change()
Text1.Text = toMoney(Text1.Text)
Text1.SelStart = Len(Text1.Text)
End Sub
Private Sub Command1_Click()
Text1.Text = toMoney(Text1.Text, M)
End Sub
-
ahi en el comand1 por ejemplo le puse un, M o sea si pongo M que formatee a millar si pongo ,Q entonces que quite el millar.
-
Public Function toMoney(ByVal srcCurr As String, FormatM as Boolean) As String
if FormatM then
toMoney = Format(srcCurr, "##,###0")
else
toMoney = Format(srcCurr, "###0")
endif
End Function
Text1.Text = toMoney(Text1.Text, True) 'Devolver con millar
Text1.Text = toMoney(Text1.Text, False) 'Devolver sin millar
-
Impecable, funciona de lujo...
Gracias...