Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Format Decimal, Currency Like...


Frustrating, Looking for some serious fast help from anyone, thanks for any replys of help. My problem might be easier than I can see... What I have is a textbox with $0.00 and I want to be able to click any of the buttons, 1-0. When I click 1 for the first time I want the textbox to = $0.01, If I click button 1 again, next to = $0.11 and so on = $1.11 -> $11.11 -> $111.11, so I need to keep a format I guess, but I can't seem to get the format code to work. I been working with this for several hours, I didn't ask for help because I believed I could figure it out myself but seem to be stupidified. I know how to make the string continue... example textbox = textbox & "1" but next I need the format = "$0.00" Appreciate any help from people. Thanks

Zack




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Format Currency With Digit Decimal
Hello all,
  is there a format express or a way in visual basic 6.0 to format a value i.e. 100 = 100.00. no matter, what I try it always give me 100 and I want i to show as 100.00.

Thanks, Joe

Decimal Currency Problem
Hello All,

I have a small problems that's causing major problems,

I have a text box which a user enters a price which is then set to a varible "AmmuntEntered" but my problem is a user can input a figure like $23.7676 into the text box which is then rounded up in the varible.

But in the real world we dont have money like this so is there a way of stoping a user entering more that 2 digits after the decimal place?

I have tried the Following but with no luck


If TxtEnderd.Text <> Format("#.00") Then
MsgBox "Error"

oh The user is not using the keyboard to enter values they are buttons to enter 0 - 9 and the Decimal

thanks for any help

Currency And Decimal Points
Is it possible to change the format of a textbox so that it only allows 2 decimal places. If so would you be able to tell me the code for this.

Currency Field With Decimal
I have a problem with access field which currency type I have put it as 3 decimal, when I type something like 1.655 it works fine and save it the same like 1.655 in the table but when I type 1.500 it saves only 1.5 in the table is there away to save it like 1.500 and show 00??

Thanks in advance.

Currency Field With Decimal
I have a problem with access field which currency type I have put it as 3 decimal, when I type something like 1.655 it works fine and save it the same like 1.655 in the table but when I type 1.500 it saves only 1.5 in the table is there away to save it like 1.500 and show 00??

Thanks in advance.

Decimal Currency Problem
Hello All,

I have a small problems that's causing major problems,

I have a text box which a user enters a price which is then set to a varible "AmmuntEntered" but my problem is a user can input a figure like $23.7676 into the text box which is then rounded up in the varible.

But in the real world we dont have money like this so is there a way of stoping a user entering more that 2 digits after the decimal place?

I have tried the Following but with no luck


Code:
If TxtEnderd.Text <> Format("#.00") Then
MsgBox "Error"


thanks for any help

Formatting Currency In 2 Decimal Place
Hi All,
Does anybody knows how to format currency in this mode "150.00" (2decimal place). I code it as



txtCharges = Format$("#####0.00") but it doesn't work. I get theanswer with "150" only.

Thanks.

Rgds,
Khai Sze

Format Currency To Indian Format In Label/Textbox
Hi folks,
I am trying format the currency data in DB (Acs 2003) into Indian currency format 00,00,00,000 for which I used the below code

vbcode Code:
Me.lblAmt.Caption = Format(CCur(rsCurrent.Fields("suitAmount")), "##,##,##,##,##,##0")

but during display nothing happens i.e. the display continues to be the US format.
Can somebody show me how.
Thanks in advance.

Setting Decimal Places On System Currency
Hi there.
I wish to set the number of decimal places within vb6 code of the system currency. Currency is normally set to two decimal places, but I need to check the number of decimal places and change it if neccessary all within
vb6 code.

No Currency Or Decimal Symbol Is Allowed In Sorting Column
I was looking all arround on the internet and I didnt find nothing to sort currency numbers ($1,385.24) or double numbers (1,635.25) on a mshflexgrid column.

Somebody know how to sort them on the mshflexgrid or msflexgrid control?

Thanks!

How To Make A Currency Value Show 2 Decimal Places &lt;Resolved&gt;
Hi
I have a function which calculate a dollar value to be written into a table in a word document. When the value has a zero as the second number the value is being written without the zero. Here is the code I have written.

public function calculate(min as integer, watt as integer, tariff as single) as Currency 'if min=50, watt=100, tariff=0.13
    Dim a, b, c, d As Integer
    Dim e As Currency
    a = (min * 365) 'makes a=18250
    b = a / 60 'makes b=304.166666666667
    c = b * watt 'makes c=30416.66666666667
    d = c / 1000 makes d=30
    e = Round((d * tariff), 2) 'makes e=3.9
    calculate = e
End Function

How do I make the value = 3.90?

Simon

When all else fails, blame someone else!
If there is no-one else around, blame the computer!

Edited by - s_morriso on 6/27/2004 5:11:49 AM

Currency Format Help Please
Hi

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


Code:
Private Sub cmdNum_Click(index As Integer)
Select Case cmdNum(index).Caption
Case "0" To "9"
txtTender.SetFocus
txtTender.Text = Format(cmdNum(index).Caption, "Currency")
SendKeys cmdNum(index).Caption
End Select
If cmdNum(index).Caption = "." Then
txtTender.SetFocus
SendKeys "."
End If
End Sub
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.

Many thanks

Currency Format
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)
End If
End Sub

Thank YOU

Format Currency
Hi,

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

Z

Format Currency?
This what I tried but its not working


Code:
Private Sub txtCurFields_Click(Index As Integer)
Select Case txtCurFields(Index)
Case txtCurFields(0).Text
txtCurFields(0) = FormatCurrency(txtCurFields(0).Text)
Case txtCurFields(1).Text
txtCurFields(1) = FormatCurrency(txtCurFields(1).Text)
Case txtCurFields(2).Text
txtCurFields(2) = FormatCurrency(txtCurFields(2).Text)
End Select

End Sub

The array has many more textboxes ofcourse but this is what I am using to test it.

I want all of the fileds to format for currency

Oh and where should this be.. in the click or change or else where

vbMarkO

Currency Format
How do I set the Currency format to

3, 000

instead of 3000

I want a comma after 3 digits. If u know of a way to set it, please let me know. Thanks

Format Currency
Is there a way to format $20.00 to read "Twenty"

Format As Currency
Here is my code:


Code:
format$(strSomething, "Currency")


i am storing a number into a variable, and then i want to make that number come out as currency. However, i get an error saying that a = is required after the end parenthesis. I would guess that i cant format the value this way becuase it is in a variable (opposed to just putting in "########"). If thats the case i have no idea how to get it to work.

Format Currency.. Help
How do I make the outputs in the Captions for the Labels come out as Currency? Like $5.00 for example..
I tried adding FormatCurrency in front of the label name, but it did not work.
Thanks.


VB Code:
Private Sub cmdCalc_Click()   Const BurgerP As Currency = 1.25   Const FriesP As Currency = 1   Const DrinkP As Currency = 0.75   Const Tax As Currency = 0.08   Dim intBurgerQ As Integer   Dim intFriesQ As Integer   Dim intDrinkQ As Integer   Dim curTotalF As Currency   Dim curTax As Currency      intBurgerQ = Val(txtBurgerQuantity.Text)   intFriesQ = Val(txtFriesQuantity.Text)   intDrinkQ = Val(txtDrinkQuantity.Text)      lblTotBurger.Caption = intBurgerQ * BurgerP   lblTotFries.Caption = intFriesQ * FriesP   lblTotDrink.Caption = intDrinkQ * DrinkP      curTotalF = Val(lblTotBurger.Caption) + Val(lblTotFries.Caption) _   + Val(lblTotDrink.Caption) + Val(lblDeliveryCharge.Caption)      lblSubTotalDisplay.Caption = curTotalF   curTax = Val(curTotalF) * Tax   lblTaxDisplay.Caption = curTax      lblTotalDisplay.Caption = curTotalF + curTax End Sub

Currency Format
The user enter "1023.2" into a textbox. I want to use printer.print to get "$1023.20". How do I format so both the dollar sign and the zero is shown on the printout?

Format A Label As Currency
I am trying to format a label as currency. The data is from a datasource and is formatted in the database as currency, but when the data shows on the form it is not formatted. How can I format this data to appear as currency when the form is printed or viewed at runtime?

What Is The Format For Indian Currency?
Dear Friends,

What is the format for Indian Currency?
Say, for US format for currency : 200,000.00
and Indian currency format is like this : 2,00,000.00

txtCash.Text=Format, " ???? "

So, what is the format to be written for a txtbox?

Regards,

vblearner6

Currency Format In Different Region
how to get the currency format?

i mean in indonesian it's like this ex: 1.234.567,00
in US ex: 1,234,567.00

not sure in other countries

since i making a ConvertToText program but it fail when it met US region
if i code the possibilities then it wouldn't make sense since what if somewhere the format might like 1#234#567*00

hope u know what i mean

thx

Format Number As Currency
Alright now; this problem has been seriously bothering me.

I'm attempting to make something that displays an amount of money for every hour/minute/second worked.

It works, but the number I get has an obscene amount of numbers after the decimal point.

How do I format the number like a currencey?(USD)

so, that it's like #####.## with only two numbers after the decimal point?

Thanks in advance.
~R

RESOLVED Currency Format
I have a label on a form which is calculated from values in other text boxes, and im trying to format the total label into the currency format, but all its ends up printing in the label is "lblTotal.Caption" and not formatting the number

for Example




VB Code:
lblTotal.Caption = txtOne.Text + txtTwo.Text Format("lblTotal.Caption", "Currency")


what am i doing wrong?

Format Text Into Currency
What I want to do is format my text into $999, 999.99

I use format("txtbox.text", "Currency") which works when the values is less than $9999.99, but when I want a number say like 123456.78, it will give me $123456, w/ no decimals. I wanna be able to enter in dollars amounts less than a million and be able to format it like $999, 999.99

How is this done?

Thx.

How Format A Textbox For Currency
How to format a textbox for currency without using Maskedit Box. The only way at the moment is read the textbox and write back to the textbox with format function in the coding. This somehow creates some complication in the multiuser environment because the data is bound to a table.
Because it writes back to the textbox with the currency format "#,###,##0.00" it's actually changing the field.

Is it possible using API? Or is there any possible way where the format can be set and without have to use Maskedit or Richtextbox.

Please advise..

Thanking in advance

Currency Format And Validation
my application needs to allow user enter different currency, and I want to validate that currency code is a valid one, and format it as well.
an example:

if the user enters 100 and if the windows setting is USD, then it needs to display 100.00USD. if the user enters 100NZD, then I need to validate if NZD is a valid currency code, if it is, display it as 100.00NZD.

I looked at the format, FormatCurrency. but both seem to only use the windows setting for the currency. is there any built in function that parses a string, validates currency code, and reformat the string into currency format?

Thanks.

Format Flexgrid Column As Currency
Is it possible to format a flexgrid column to show as currency? Eg:$34.25 ?

Currency Format In Bound Textbox
Can someone help me out, I'm new to VB? I'm trying to currency format a db bound textbox. When I use "txtFields(3) = Format(txtFields(3).text, "Currency")" on a change event, I can't modify my data properly because it's triggered on the first keystroke.
I'm running vb5 and can't find any help on MS.

Thanks Thinker, the lostfocus event is good but formating does not appear on the form_load event. How can I trigger it to load with formats?

Database Grid: Currency Format
my dbgrid is not retriving the correct values of currency fields. If i put 3,50 euros it will retrieve 3 euros.

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

Currency Display Format For A MaskEdBox
I have a MaskEdBox input field and i want to set it up so that only numbers can be enetered in the input box. No decimals or letters.


I think i need it in the key down action i think.....

Currency Format In Text Box (RESOLVED)
Hello everybody

I have this very simple question! How can I change the type of a text box to currency. E.t.c. I would like it to display a dollar or Euro sign after the amount is typed!

thx, in advance

George Papadopoulos

MSHFlexGrid Format A Column As Currency
I am just starting to use the MSHFlexGrid I'm used to the standard DataGrid so it was no problem formatting columns as currency so they showed as an example $4500.00. I'm trying to do the same with the MSHFlexGrid but it shows just 4500 not $4500.00. The db is Access and those fields are set to currency and the default is $0.00 in the db anyone know how to fix it??

Sorry I'm just stupid when it comes to the MSHFlexGrid.

How Do I Format A Numeric String As Currency?
i would like to take the string 54367 and make it $543.67
is there a function that will do this?

Format Cell To Currency - Error '1004'
Hi,

I'm trying to format a cell to currency once I've dropped the data on a sheet, but I get the following message: -

Run-time error '1004':

Unable to set the NumberFormat property of the Range class

This is the code I'm using: -


Code:
Cells(lngPosY, 4).NumberFormat = "Currency"
If I format it to a number i.e. '#,##0.00' it's fine.

Why is this error happening?

Regards

How Do I Add Numbers From Text Boxes In Currency Format?
I have 3 text boxes. I want to add text1 which is £3.00 to text 2 which is £4.00 and the answer to appear in text 3. However for some reason i cant perform this simple task. Please help. Thanx.

How To Format A Column In Data Grid As A Currency?
Hi, i have datagrid.
I want to format one of the column as a currnecy. Is it possible?
This is what i've done..but there's syntax error. Any idea?

Code:datagrid1.Columns(2).DataFormat = currency

thanx..

Format Currency Padded W/ Leading Blanks
I am trying to write a currency amount to at RichTextBox and format it like this:

My Input Data is the string: "00278144+"
I want it to display like this: "$__2,781.44" (where the underscores are actually blanks/spaces)

I've tried Format("00278144+", "$###,##0.00), but that doesn't seem to work.

Got hints?

Crystal Reports - Change Currency Format
I've designed some reports that will be used in different areas (Ireland & UK), so my VB app needs to be able to change the report currency format at run time.

I assume you're able to do this using the Crystal Automation Engine, does anyone know of any source for this - must be something that people do quite regularly!

Any links/code appreciated

Thanks

Need To Make My Labels Appear In A Currency Format And Display $ Sign So $0.00
What i need to do is that when i press add, i want the label to just display it in a currency format e.g. $0.00.

Ohk thats the code for my entire project, I think you should only need to read the code in cmdAdd.

Also I attached my project. If you see it you'll see a dollar sign but thats just a separate label with it in $, kinda cheap i know.

How I Can Include Indian Currency Format In Data Report
hi...
pls help me by providing information about how we can include indian currency format with data reports...thank u

TextBox Wanting To Make Input Text In Currency Format
Ok I am wanting to make the text typed into the textbox to be in currency format.

What I am wanting specifcally is when the user inputs text like; 30,000 or 30000 to automatically change it to $30,000.00

So if they were to type 1 it would be $1.00 or 100 $100.00 ect ect ect

Can this be done?

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.

Decimal Format Help
I'm trying to display the result of an equation in message box and I want one digit to the right of the decimal to ALWAYS show, even zeros. I've tried using a '#' and I've also tried using a '0' and both times the zeros don't show. My book says that putting a '0' in the format should make zeros show, but it isn't working for me. What am I doing wrong?


Dim MT1Marg As Single

MT1Marg = Format((MT1Count / TotalCnt) * 100, "###.0")

msgbox (MT1Marg)



This is driving me crazy..Please help.

Thanks!

Decimal Format
Option Explicit
I want to set 2 decimal places after the comma.
My code:

<VB code>
Dim price As Double

Private Sub Form_Load()
price = 14.469
price = Format(price, "#0.00")
' result is: 14,47 -- Result ok

price = 14.4
price = Format(price, "#0.00")
' result is: 14,4 -- result not ok, I want 14.40

price = 14
price = Format(price, "#0.00")
' result is: 14 -- result not ok, I want 14.00
End Sub

<VB code>

best regards.

Decimal Format
Quick ?

assign 2 decimal placement to a label caption read from a recordset value

I tried using the Data Format field of the Label to set to 2o decimal places.

What is the Convert Function. I don't recall.

Thanks
Silly Me

Format Decimal
Need to know how to format a decimal before it is calculated, so that it won't be rounded until after it is calculated. It is declared as a single.

thanks

Copyright © 2005-08 www.BigResource.com, All rights reserved