Help! Calculator Problem!

PureFlamez

Newcomer
Joined
Oct 13, 2003
Messages
2
I've been trying to work this calculator all day! my formula is:


Private Sub cmdCalculate_Click()
If (Val(Range) * 1.5) > (Val(Attack) + Val(Strength)) Then
Combat = ((Val(Range.Text) * 1.5) / 4) + (Val(Hits.Text) / 4) + (Val(Defense.Text) / 4) + (Val(Magic.Text) / 8) + (Val(Prayer.Text) / 8)
Else
Combat = ((Val(Attack.Text) + Val(Strength.Text)) / 4) + (Val(Hits.Text) / 4) + (Val(Defense.Text) / 4) + (Val(Magic.Text) / 8) + (Val(Prayer.Text) / 8)
End If
Text4.Text = Combat
End Sub


it says runtime error 424. object required. WhY?
 
If Combat is a integer, then try

Text4.text = Cint(Combat)

Other than that i cant see anything that would cause an error.




Dan
 
This errors in generated because you have an object, and you haven't called it's constructor. Object reference.
EX:
Dim process as Process, should be,
Dim process as New Process

check your code for an oject reference, and keep me updated so that I help you. The string integer thing doesn't generate that kind of errors. It genrates some thing like this: Can't compare a string to an integer or so..

Mohsen
 
Back
Top