|
-
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
-
Jan 30th, 2008, 02:17 PM
#2
Re: how do you convert values into currency format
Welcome to the forums. 
How to make a textbox accept only numbers is a question that gets asked a lot. Here is just one of many.
-
Jan 30th, 2008, 02:36 PM
#3
Thread Starter
New Member
Re: how do you convert values into currency format
that is useful but now i need to know how to convert values into currency format-read through my original question if necessary
-
Jan 30th, 2008, 02:39 PM
#4
Re: how do you convert values into currency format
I read your original question.
You don't "convert" it. If you want a number to be formatted to appear as though it is currency, then simply use the Format function.
The Format function can take a number and make it appear to be anything you need it to be.
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
|