PDA

View Full Version : Simple calculation.. Please help me out!


eric_lof
03-16-04, 03:36 PM
Need to do the simplest calculation in VB, but it keeps freaking me out;

I have the following code;

Private Sub Command1_Click()

decVacuumperif = decAttpitch1 + decAttpitch2

End Sub

.. if i put 1 in Attpitch1 and 2 in Attpitch2 and execute i get 12 (!)
So, i does not calculate, it just puts the numbers after each other.

Please help me out, i'm really new to this..

chemical
03-20-04, 12:01 AM
Because decAttpitch1 and decAttpitch2 contain strings. Declare them as Long or do the following:

decVacuumperif = CLng(decAttpitch1) + CLng(decAttpitch2)