At the moment I am getting results in a text box coming up as 0.1 when they should read 0.10
I know I havent given much information here but can you give me an answer just from that?
Printable View
At the moment I am getting results in a text box coming up as 0.1 when they should read 0.10
I know I havent given much information here but can you give me an answer just from that?
use Format function, i know I haven't given much but maybe you can get the answer just from that :)
Hint: Text1 = Format(Text1, "0.00"). If text1 had "0.1", it will have "0.10" after the code.
"should" according to whom? Mathematically, they are identical, so I assume you're just looking for help with the cosmetics. Try "format" in the on-line help
According to me. If one of my customers see 0.1 they will assume they are only paying 1p when really its 10p. I know for 1p it would be 0.01 but I would really like to know how to get 0.10 to ease any confusion. Im no good with VB so dont have a clue.
well, then use the "format" function as both dmitri and I have said !
Doesnt work for me, and Ive tried all suggestions from someone on here who is a VB genius too.
here is my code if you can help.
VB Code:
Dim LINES as Double Dim TOTAL as Double Private Sub txtlines_Change() LINES = txtlines.Text If cmoperms.Text = "10p" Then TOTAL = Round(CDbl(("0.10")) * LINES, 2) End If txttotal.Text = TOTAL End Sub
Format hasnt worked for me so far, so its not in there now....
VB Code:
Dim LINES as Double Dim TOTAL as Double Private Sub txtlines_Change() LINES = Cdbl(txtlines.Text) If cmoperms.Text = "10p" Then TOTAL = Round(CDbl(("0.10")) * LINES, 2) End If txttotal.Text = FormatNumber(TOTAL,2) End Sub