hey guys,
im sure this is a really easy thing to do but, im currently trying to make a form that basically you enter numbers into three text boxes and it pumps and the sum in a label. I've got this working fine except for decimal places. using code" label.text = int(val(txtbox.text) +val(txtbox2.text)) "
i haven't done any coding in vb since 1996 so im a little hazy i think it has something to do with the int but not sure.

any help would be great
thanks

try:

Label.Text = CSng(Val(txtbox.Text) + Val(txtbox2.Text))

You are right integer variables don't have decimal places, they are for whole numbers only. Use float double or decimal variables.

thanks guys csng worked a charm.... is there a way to make it display 2 decimal places as in a currency 100.10?? it works ok if you have used 2 decimal places providing last one isn't a zero.

thanks heaps you guys are wonderful

thanks heaps you guys are wonderful

:$ aww you're embarrasing us!

Hey it's now problem, glad we could help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.