|
-
Jan 30th, 2008, 02:06 PM
#1
Thread Starter
New Member
how do you convert values into currency format
i am using visual basic 6.0 and on one of my forms i need to do a calculation that calculates the difference between incomings and expenses-i have figured out this code and the code works fine
Heres the problem, at the moment in the textbox the user can enter anything, i want it so that the user can just enter numbers-and the textbox format will be currency-i dont know how this works-maybe when the user enters for example 100 this will automatically convert into (when the user goes to next textbox) £100.00-if there is a code for this please post below cuz i am really stuck-
here is the code i have at the moment
Private Sub cmdCalculate_Click()
txtProfit.Text = Val(txtIncomings.Text) - Val(txtOutgoings.Text)
If Val(txtProfit.Text) > 0 Then
txtProfit.ForeColor = vbGreen
Else
txtProfit.ForeColor = vbRed
End If
If Val(txtIncomings.Text) > Val(txtOutgoings.Text) Then
lblResult.Caption = "You made a profit!"
Else
lblResult.Caption = "You made a loss!"
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|