|
-
May 22nd, 2000, 06:38 PM
#1
Thread Starter
Fanatic Member
Hi
Please, How I sum 2 textboxs with decimal, I tried with val function and It give me only integer part
-
May 22nd, 2000, 06:48 PM
#2
Addicted Member
Hi there, I have no problems with this.
But you must make sure of what separator of decimals you use.On my machine if I sum 2.2 + 2.12345 I get 4,32345, BUT if I write 2,2 + 2,12345 I get 4!!!, notice it works with dot, but not with comma, I guess this is what you need to do.
André
-
May 22nd, 2000, 07:25 PM
#3
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!)
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
|