|
-
May 22nd, 2000, 03:54 AM
#1
Thread Starter
Fanatic Member
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
-
May 22nd, 2000, 04:27 AM
#2
transcendental analytic
What are you doing? it's int that gives the integer part not val.
Post the code
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 22nd, 2000, 06:52 PM
#3
Thread Starter
Fanatic Member
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
-
May 22nd, 2000, 07:18 PM
#4
Fanatic Member
Try this
Code:
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
...and have a good weekend...
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
-
May 23rd, 2000, 03:19 AM
#5
transcendental analytic
This explains your problem
Code:
?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
I hope you understand what's wrong
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
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
|