RunTime Error 424 Object Required, VB6.

October 2, 2009 at 04:08:18
Specs: Microsoft Windows XP Home Edition, 2.002 GHz / 735 MB

Hi world,
I have been working on a game and I have come across this error - "RunTime Error "424" Object Required".
I understand what it means and how to fix it however I have been trying to figure it out for literally hours and i'm stumped.


Code:

Private Sub Label5_Click()

If RIFLE.blnACTIVE = False Then
If Money >= 1500 Then
Money = Money - 1500
RIFLE.blnACTIVE = True
Label5.Caption = "$3000 - Upgrade Rifle"
Form1.Option2.Enabled = True
End If
ElseIf RIFLE.blnACTIVE = True And RIFLE.sngLEVEL < 6 Then
If Money >= (6000 * (RIFLE.sngLEVEL / 2)) Then
Money = Money - (6000 * (RIFLE.sngLEVEL / 2))
RIFLE.sngLEVEL = RIFLE.sngLEVEL + 1
End If
ElseIf RIFLE.snglvl = 5 Then
MsgBox "Sorry, But your Rifle is at it's maximum level", vbOKOnly, "Zombie Defence"
Else
MsgBox "Sorry, You have insufficent funds", vbOKOnly, "Zombie Defence"
End If
End Sub

Code:

The error points to the line which is in italics.
I do have a module which may have somthing to do with it...


Code:

Public Type GUNTYPE
blnACTIVE As Boolean
blnAUTO As Boolean
sngDAMAGE As Single
sngRELOADTIME As Single
sngFIRERATE As Single
sngCOST As Single
sngAMMO As Single
sngLEVEL As Single
End Type

Code:

money is also dimentionalised and form1.option2 does exist.


See More: RunTime Error 424 Object Required, VB6.

Report •


#1
October 2, 2009 at 05:32:31

money is also dimentionalised and form1.option2 does exist.
RIFLE on the other hand, does not.

Report •

#2
October 2, 2009 at 10:32:41

I find this Hungarian style grating. When you've got Intellisense built into your IDE there's not much use in making your code illegible by prefixing your names with unpronounceable characters.

If RIFLE.blnACTIVE = False Then
>>> If Not Rifle.Active Then

ElseIf RIFLE.blnACTIVE = True And RIFLE.sngLEVEL < 6 Then
>>> ElseIf Rifle.Active And Rifle.Level < 6 Then

Also why is Level a Single when it could be an Integer? And you've got RIFLE.snglvl near the end, which is mistyped.


Report •

#3
October 2, 2009 at 13:34:32

klint: I find this Hungarian style grating.
Meh, it's what Microsoft harped on in the VB6 age. I do find Systems Hungarian notation to be pointless at best. MS agrees.

[I]f you write convoluted, dense academic prose nobody will understand it . . . and then the misinterpreted ideas will be ridiculed. -- Joel Spolsky


Report •

Related Solutions

#4
October 2, 2009 at 16:08:57

lols, thanks.
I cant believe I forgot that, I works now.
The only problem with the part im doing now is that I have to finnish a round before it comes up, im already bored of my own game. :(
for the sake of testing I wont change it temporarily.
I also changed it to an integer. all the others are singles because in the equasion that determines that value, at some point will cause a decimal.
If you want just e-mail me if you want a copy, its not finnished but its really close.

Report •


Ask Question