Convert To Currency
I have aproblem I working on Is This correct... I assume that all variable have been declared
Write a code that will convert currency. Assume listbox(lstCurremcy) has the following foreign currency (index in parenthesis): (0)Pesos, (1) Euros, and (2) Yen. Use the following conversion rates: Pesos (8.25 to $1), Euros (1.35 to $1), and Yen (1.26 to $1). The user should select an entry in the listbox and place a dollar amount in txtDollar. You’re to convert the amount in txtDollar to the foreign currency and place your answer in lblConvert.
Public Sub ConvertToCurrency (Number) as Integer
If lstCurrency(listindex). Peso then
lblConvert=xtDollar * .0825
Elseif lstbox lstCurrency(listindex).Yen
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Convert Figure To Currency
I recently had to create an app where i had to work out how much pennies a person would have at the end of a 30 day period.
The question was:
'Today, I’ll give you a penny. Tomorrow, I’ll give you two pennies. I’ll keep doubling the amount that I will give you for 30 days. How much will you have at the end of the month?'
After working this out, the person would have 1073741823 pennies.
What i would like to do is, at the press of a button, convert this 10 digit figure into pounds (sterling), and having it displayed as currency.
What i though of doing was:
currency = total / 100
lblsterling = currency
Would this work, or is there another way of converting it to currency?
Thanks in advance for your help
Convert Currency Into Words?
does anybody knows how to convert currency into words? for example: $ 1,206.31 = one thousand two hundred six dollar and thirty one cents. pls give it a shot.
Convert Currency Into Words
does anyone knows how to convert a currency eg. 11,258.64 into words.
pls help. thanks in advance.
I Want To Convert Currency From One To Another......please Help Me [ Urgent ]
I have listview(listinvoice) in my form, it contains 6 columns, serial number, products,Produc Description, quantity, unitprice and Amount.I have one textbox(txtTotal) on same form. It displays the sum of items in column "Amount". I also have one combobox(cmboConverter) on the same form. Combobox contains items, such as "US dollar","Australian Dollar", "Singapore
Dollar", etc. And default currency is Nepalese currency. And the value of other currencies corresponding to Nepalese Currency are stored in my database(eg. lets say 1 USD equals 78 Nepalese currency). All i want to do is that whenever i change the currency format in combobox. It will convert to the currency format that i changed in combobox equivalent to the currency that was previously on that textbox.
I also want to change the columnheader from "Amount" to "Amount(USD)" if i change the combobox item to "US DOLLAR".
Please anyone help me with this, i'll be really grateful.
Quote The Quotation-"The height of great men, reached and kept were not attained by
sudden flight, but they when their companions were slept, toiled upward in
Edited by - saracjl on 4/5/2005 4:50:50 AM
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
txtProfit.ForeColor = vbRed
If Val(txtIncomings.Text) > Val(txtOutgoings.Text) Then
lblResult.Caption = "You made a profit!"
lblResult.Caption = "You made a loss!"
Convert Numeric Currency To English
In VB6, is there anyway to convert numeric currency amount to English words? For example, when a program gets input $100.00, it outputs One Hundred Dollars 0 Cents.
Convert Currency To Words (Indian Format) In Crystal Reports
Please can anyone help me how to convert number to words in Indian format in Crystal Reports.
eg. I want to convert Rs.25,12,000 as Rupees Twenty Five Lakhs Twelve thousand only.
The towords function converts into millions and billions and i want the result in Lakhs and crores.
Thanks in advance.
Insert Currency Data Type To MS Access Currency Field
Im want to insert a into a currency field in ms access using vb 6.0 but i keep gettin an error message. What should i place around the value to denote insert it.
here is my code:
Dim sqlstmt As String sqlstmt = "INSERT INTO tbl_Products (ProductName,ProductDesc,SalesPrice,SpecialOffer,SpecialOfferPrice) VALUES (" & _ "'" & p_prodName & "', " & _ "'" & p_prodDesc & "', " & _ "'" & p_sPrice & "', " & _ "'" & p_specialOffer & "', " & _ "'" & p_soPrice & "' " & _ ")" MsgBox sqlstmt db.Execute (sqlstmt)
Numeric Currency Value To Word Currency Value
Guys I want to know how we can change Numeric Value of currency to the Word value.
for Ex. If we enter value in textbox “210” after clicking a button change, it will display in the label that “Two Hundred ten only” in label.
I want at least for up to 5 digit.
So I want this type of program for VB Give me whole coding for that Or attach the whole created project that u have done plz help me.
By the way, Happy DIWALI & new YEAR , It is Indian Festival.
i have a variable as currency but if i place the value 5.00 into it it always comes out as 5 without the .00
is there a way of keeping the two decimals?
can anyone tell me how to do this.
I need to add and multiply currency with an integer and yeild a dollar ammount. ($12.50)
Right now it will give me this- $12.5 or if it is a whole # I get this $12
I need- $12.50 or $12.00
Thanks in advance for the input.
i have a form. When the command button is clicked values(numbers) are added.
However, i want the total box to not just show for example, 45.00. but £45.00.
how do you do this?
ya know how you create a field to a table
.createfield ("new field", dbtext, 50)
well how do you do currency? i tried this
.createfield ("new currency", dbcurrency)
this works "BUT" i need it to format it in currency in ms access , it gives it the currecny type but it don't format it.
I am trying to give a label the data format of currency. I select DataFormat | Currency from the properties menu but when i load up my form it still displays integers normally instead of currency like i selected.
I assume I have to do more than simply select currency as the DataFormat?
Thanks in advance
i am using access database , i have 2 fields rate and quantity
what is the best data type in which these must be stored
i am having decimel values but if i use decimel as the dattype then it discards the digit after decimel
i need get sum two Currency numbers
dim num1 as long
dim num2 as long
dim num3 as long
num3= num1 + num2
i get 5 instead 4.72?
Dim As Currency
I have this bit of code that counts up boxes in a flexgrid
i have set total to currency - the db field that the info comes from is currency but for the life of me cant get the txttotal.text to display the decimal point.
is there a format command any of u know of?
Private Sub addTotal()
Dim iRow As Integer
Dim Total As Currency
iRow = 2
For i = 3 To mfgcomponents.Rows
Total = Total + mfgcomponents.TextMatrix(iRow, 3) ' 4 - fourth column's total
iRow = iRow + 1
txtTotal.Text = Total
Currency From VB
How can a format a cell in Excel to currency from VB?
I think I have the first bit but I can not figure it out
Also how do I format column B so that everything in it is centred?
in my Access table, i have defined Costs as currency and the it shows the "$" sign.
but when i load the values from the table to a combo box, it only shows the values without the "$".
Please help me with this one....I use a ADOX so that I can create table using VB codes. My problem is how can I eliminate the dollar sign and format a certain amount into two decimal places in the centavos place using Vb 6.0 codes?
Currency From VB To VC++
I have a structure in VB:
a As Long
b As Long
c As Currency
and I need to pass these data to a C++ DLL. My DLL has:
The question: Is this way correct to pass currency values from VB to VC++?
OK, I want to enter a number and then use that number to get another number.I have been trying to format both of these numbers as currency, but I am doing something wrong.When I enter the first number I need a "$" in the text box, and when the second number is calculated I need a "$" in front of that.Also the numbers behind the decimal go back four places and I really only want them to go back to.Any ideas?
private Sub cmdCalculate_Click()
Dim GrossYearlySalary as Currency
Dim GrossMonthlySalary as Currency
GrossYearlySalary = Val(txtGrossYearlySalary.Text)
GrossMonthlySalary = GrossYearlySalary / 12
lblGrossMonthlySalary = GrossMonthlySalary
private Sub cmdExit_Click()
private Sub cmdprint_Click()
private Sub mnuExit_Click()
how do i put a code in my program to give results from the calculations into a currncy format and not all the decimal places
Hi All ... thanks in advance.
I have created a quoting & estimating package that is now getting attention and potential buyers from other countries. In many places in the app, I have to format for different currencies. Rather than using the Windows settings ... I decided to force the issue within the code ... formatting strings and text boxes using the users selection from the made-available currencies.
The problem ... I can get the currency symbols for most of the desired currencies like £ and ¥ ... but can't get it for all. I'm looking for Chinese yuan and some others.
I thought it was a function of the FONT in the IDE but that doesn't seem to help. Even if I create the symbol in say WORD and try to copy and paste ... that doesn't work either.
Any ideas on how I can get these symbols to appear in the VB5 IDE and therefore in the TEXT boxes and such?
Again, thanks in advance.
MaskEdBox For Currency
Greetings, I'm trying to make a MaskEdBox for Currency input. We're writing code in a procedural language to generate Visual Basic screens, so I need to do this with as little code in Visual Basic as possible. Is there any easy way to do this? Just using a mask like ###.## doesn't work, since it starts at the first space and then if you just want to input 50.04 you have to move forward, it would be nice if you could input the value without having to set the decimal place, or enter it and then have the decimal point move two away from the last numeric value...
Any help would be appreciated.
Currency In Textbox
Hey all, im in need of some help in checking for decimal place and other stuff in my txt box.
this is my code right now:
Private Sub cmdCashTotal_Click()
Dim Change As Currency
Dim LooseChange As Currency
If txtDigits = "$" Or txtDigits = "" Then
MsgBox "Your need to enter an amount first", vbInformation
ElseIf Mid(txtDigits, 3, 1) <> "." Or Right(txtDigits.Text, 1) = "." Then
MsgBox "you need to enter a correct amount", vbInformation
If cmdCashTotal.Tag = "GotChange" Then
Change = Format(Replace(Val(txtDigits.Text - txtHoldChange), "$", ""), "0.00")
cmdCashTotal.Tag = "NoChange"
Change = Format(Replace(Val(txtDigits.Text - lblTaxTotal), "$", ""), "0.00")
If Change < 0 Then
MsgBox "You need " & Replace(Change, "-", "") & " more to complete this transaction", vbCritical
LooseChange = Format(Replace(Change, "-", ""), "0.00")
txtHoldChange = LooseChange
cmdCashTotal.Tag = "GotChange"
txtDigits.ForeColor = &HFF&
txtDigits.Text = "$" & txtHoldChange
txtDigits.Text = "$"
lblChange = "$" & Change
Problem with the code above is that if i enter $100 then it will tell me that "you need to enter a correct amount".
It works fine if i have an amount like $20 or even $20. or 20.0
But once i try putting $20.00 for some reason it still tells me "you need to enter a correct amount".
It works fine with $1.00-9.00.
All i am wanting is to check if the user enters a correct currency in the text box (IE: $15.00) not 15 or 15.0.. somewhere along those lines.
Any help would be great, thanks.
Currency Format Help Please
Please can someone help, I use the code below to enter numbers into a textbox, but i need the numbers in the textbox to be in a currency
Private Sub cmdNum_Click(index As Integer)
Select Case cmdNum(index).Caption
Case "0" To "9"
txtTender.Text = Format(cmdNum(index).Caption, "Currency")
If cmdNum(index).Caption = "." Then
I have added the curency bit in but it only works for the first number pushed say for example if you push 65 the textbox displays $6,00 indtead of $65,00.
Please can someone tell me what i am doing wrong.
Single Or Currency
For speed and size of program would you use singles and format the end result, or use currency for all money variables.
And Operator With Currency
Anybody have any idea why this doesn't work.....I hate math in VB...
Dim temp as currency
dim temp1 as currency
temp = temp1 and &hffffff0
I get an overflow error. I'm thinking the AND operator doesn't like currency....
I'm new on this forum, and I'm also new to VB in Excel. I have been programing in C, and programing in VB Excel is starting to be hard form me.
I have a small task. I have to make a small currency calculator and I have many problems. I would like to use some kind of combobox to store Currency Name and Value, so user may choose currency and then write amount of money, after that he Might just click Button and here we go, we have a result. Everything have to be made in Excel VB.
Well I know how to make code (and programing is quite familiar for me), but I don't know how to add data to this "combobox" (or anything else) romve or correct rate of exchange. The problem is about storing data and taking it out.
Maybe some of you have appliaction which is simillar to this, so I might look at code (if you agree).
Oh and you know some kind of trick to start functions when your application starts ? That might be also helpful.
Thanks alot for help!
I want to build an application that can access some website to get up-to-date currency exchange rate and then do calculation on the form.
Any idea on how I can accomplish this task?
Thanks in advance.
Currency Into Words
I am writing a check software, and I want to know if there is a way convert currency into words like 100.00 into One hundred dollars. OR 100.01 into one hundred dollars 01/100.
Currency Flexgrid Sql
i am cnnecting to a access database and using sql statements to call the data to be displayed. One of the fields needs to be in currency format, bnut i have no clue on how to make that happened. can someone please show me how to format currency inside the sql statement to be executed? thanks.
I have a varable that calculates to 0.6116 if I Dim as currency and as a string variable it is something like 0.611623... I thought that if I declared this as currency it would round out to 0.61 or 61 cents. Any ideas how to make it do this?
Currency Text Box
I have an access database, backend and im display the information for the cost of an item in a text box in vb!
How do i set it up in VB to display the information in the field as £230.30 instead of 230.30
many thanks for your help
Sorry if a similar question has been asked before. i did try searching, but could find anthing
I was wondering if somebody could help me. I want my values to come out as currency values. But if I enter £34.20 and then add 17.5% (VAT) of that to it, it comes out like £40.185. Here is my code...
Private Sub txtVATPrice_GotFocus()
Dim CurrentPrice As Currency
CurrentPrice = Mid$(txtDiscountPrice.Text, 2, 5)
Dim Price100 As Currency
Dim PercentagePrice As Currency
Dim VATPrice As Currency
Price100 = CurrentPrice / 100
PercentagePrice = Price100 * 17.5
VATPrice = Str(Val(CurrentPrice) + Val(PercentagePrice))
txtVATPrice.Text = "£" & VATPrice
Currency Converter HELP!
I have started designing a currency converter. The currency converter will convert pounds to dollars and back again. There is a list of different currencies in notepad.
I have on a form the following:
- A text box (TxtFrom)
- Combo box (CboFrom)
- Label (LblTo)
- A second Combo box (CboTo)
- Label (lblFileDate)
- Combo box (cboCurrency)
- File (File1)
Then i have the following code:
Private Function CalculateRate()
Dim a, b, c, d
If TxtFrom.Text = "" Then TxtFrom.Text = 1
a = CboFrom.ListIndex
b = CboTo.ListIndex
c = cboCurrency.List(b)
d = cboCurrency.List(a)
LblTo.Caption = CCur(TxtFrom.Text * c / d)
Private Sub cboFrom_Click()
Private Sub cboTo_Click()
Private Sub Form_Click()
Private Sub Form_Load()
Dim myArray As Variant
Dim myString As String
Dim I As Integer
File1.Open "A:CurrencyCurrency.txt", fsModeInput
myArray = File1.InputFields(250)
'Populate the combo boxes with information gathered from the
For I = 0 To 249
myString = myArray(I)
If myString >= Chr(65) And myString <= Chr(90) Then
ElseIf myString >= Chr(48) And myString <= Chr(57) Then
File1.Close 'Close the open "Currency.txt" file
lblFileDate.Caption = CboFrom.List(0) 'Display current file version
'Remove the first entry from the Combo Box
'Set some default Countries in the Combo Box/s
CboFrom.ListIndex = 0
CboTo.ListIndex = 1
Private Sub txtFrom_Change()
If TxtFrom.Text = "" Then
LblTo.Caption = ""
CalculateRate 'Run the function if a value is inputted
The converter will not work, There seems to be an error with then File1.Open part. Does anyone know how to correct this??
Thanks Kelly xxx
Problem With Currency In Vb6
i have an invoice form which works out total amount etc. when form is loaded here is the code (which is worked out correctly)
' tyres supplied equals same amount fitted
txtNumberOfTyresSupplied.Text = frmJobCard.txtNumberOfNewTyresFitted.Text
' price of tyres equals the tyre price in stock multiplied by the quantity fitted
txtPriceOfTyres.Text = frmJobCard.txtTyrePrice.Text * frmJobCard.txtNumberOfNewTyresFitted.Text
' invoice is issued on same date the job is complete
txtDate.Text = frmJobCard.txtDateFitted
' total VAT on tyres is worked out
txtVAT.Text = txtPriceOfTyres.Text * 17.5 / 100
' total (without discount) equals price of tyres + VAT
txtTotal.Text = Val(txtPriceOfTyres.Text) + (txtVAT.Text)
' if discount is available then it is subtracted from the total
' to give total amount
If Check1.Value = 1 Then
txtTotalAmount.Text = Val(txtTotal.Text) - (txtTotal.Text * 5 / 100)
' if discount is not available then total equals total amount
txtTotalAmount.Text = txtTotal.Text
that problem is i set txtpriceoftyres, txtVAT, txttotal, and txttotalamount to currency , but when the program is run doesn't show currency as £343.69 it shows 343.6875
does anyone know how to over come this problem ??
another qus !?!?
i have a combobox which is linked to a column in access and it selects record in the database when i run the vb6 and select a record form the combobox (combo.1) and edit that record then click close which returns back to the main menu. wen i go to the combobox agian to edited another record the last one keeps comin up. i have to end the vb6 and start it agian to edit another record. how to i overcome this problem ??
Currency Rate? Xml?
im trying to write an app that acts as a currency converter but i want it be able to get currentish currency rates from a website or something.
i know i could parse some source from a web page but im wondering if any sites have an api or xml for this?
also if i have to parse do i have to use the webbrowser control? is it possible to use the winsock control instead? if so how would i do it?
many thanks in advance.
I'm haven some problem with the format of my currency. It's selected as being United States English, but is constantly appearing as british pounds. This is happening on several PC's, and refuses to fix itself.
Does anyone have any advice on how to fix this?
I have created a program with multiple check boxes. Each time a check box is selected I want it to add a currency amount of .50 to the second text box and then add the amount in the first text box to that of the second and populate the total in the third text box. The first time a check box is selected it is accurately showing the amount in the second box as a currency of $0.50 but does not total the amount into the third box. The second time a check box is selected it goes to .5 but this time it does total the third box. As subsequent check boxes are selected it is adding the numbers up accurately...but no longer showing them as currency. Please view the code below and let me know if you can see what I'm doing wrong.
Private Sub chkToppings_Click(Index As Integer)
If txtToppings.Text = "0.00" Then
txtToppings.Text = FormatCurrency(0.5, 2)
Else: txtToppings.Text = Val(txtToppings.Text) + FormatCurrency(0.5, 2)
txtTotal.Text = Val(txtPizza.Text) + Val(txtToppings.Text)
How do I round a number (currency) to the nearest 5 cents (eg round $9.48 to $9.50, $9.44 to $9.45 or $9.42 to $9.40) ? I tried a number of ways but cant seem to get it right for all variations.
Rounding Up Or Down Currency
divil has answered my q thanks pal can't email you to thank no more advice needed thanks visualbasicforum.
divil Junior member?
found this perfect!!
Private Sub Command1_Click()
MsgBox Round(12.3265, 2)
End SubFunction Round(nValue As Double, nDigits As _
Integer) As Double
Round = Int(nValue * (10 ^ nDigits) + _
0.5) / (10 ^ nDigits)
Firstly from a database I get £23,26 then I wish to give a 20% dicount but I want to keep the final sum free of last penny ie: ##,#0.
I a trying to round up or down ie: £23,26 to £23,30
or down ie: £23,24 to £23,20
I have tried to to divide by five untill no decimal is encountered, also interigating dblvar = format(##.##) with little sucsess
am I supposed to interigate individual digits if so how?
Apreciate any help.
I have declared Vat as type Currency, and I am calculating Vat as 15% of an amount. Is there any function ar any way that I can round the Vat figure to 2 decimal places?
Thanks for any help
It's actually a very simple question.
How do I add a .00 to 500 to make it look like 500.00?
I used the Formatcurrency() format but it only gives me 500. Thanks.
i have a database in access using dao, i know how to set the allow zero length and stuff on a text type , but how do i set the format part on a currency, you know were you set it to general number, currency so on .
i have this in my create database
set f23 = tb.createfield ("newfield",dbcurrency")
then i will append and stuff , but it is putting it as a currency but it is not formatting it.