CodeItBetter Programming Another VB Programming Blog

How to Convert text into the Currency data type

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
'Coding Basics - How to Convert text into the Currency data type
Option Explicit
 
' Convert any value into currency format. If the value does not make sense, return 0.00.
Public Function cvCur(ByVal Value As Variant) As Currency
    On Error Resume Next
    cvCur = CCur(Value)
    If Err.Number <> 0 Then cvCur = 0
End Function
 
Private Sub cmdConvert_Click()
    lblCurrency.Caption = Format$(cvCur(txtCurrency.Text), "Currency")
End Sub
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.