How I sum 2 values with fractions which are in the textbox, I try with val function, but it give me only the integer part. I want all
Printable View
How I sum 2 values with fractions which are in the textbox, I try with val function, but it give me only the integer part. I want all
What are you doing? it's int that gives the integer part not val.
Post the code
txttotal_exame.Text = Format((Val(txt_ValorExame.Text) * 100 + Val(txt_ValorKit) * 100) / 100, "###,##0.00")
txt_valorExame = 186.53
txt_ValorKit = 23.62
It give me in txtTotal_exame = 209.00, It is sum only
186 + 23
thank you in advance
Try this
...and have a good weekend...:DCode:
Private Sub Command1_Click()
Dim txt1 As Single
Dim txt2 As Single
txt1 = CSng(Text1.Text)
txt2 = CSng(Text2.Text)
Label1.Caption = Str(txt1 + txt2)
End Sub
This explains your problem
I hope you understand what's wrongCode:?Format((Val("1,26767") * 100 + Val("1,3") * 100) / 100, "###,##0.00")
2,00
?Format((Val("1.26767") * 100 + Val("1.3") * 100) / 100, "###,##0.00")
2,57