Computing.Net > Forums > Programming > RunTime Error 424 Object Required, VB6.

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

RunTime Error 424 Object Required, VB6.

Reply to Message Icon

Name: da1da2da3ofme
Date: October 2, 2009 at 04:08:18 Pacific
OS: Microsoft Windows XP Home Edition
CPU/Ram: 2.002 GHz / 735 MB
Product: Acer / Aspire t120c
Subcategory: General
Comment:

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.



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: October 2, 2009 at 05:32:31 Pacific
Reply:

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


1

Response Number 2
Name: klint
Date: October 2, 2009 at 10:32:41 Pacific
Reply:

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.


0

Response Number 3
Name: Razor2.3
Date: October 2, 2009 at 13:34:32 Pacific
Reply:

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


0

Response Number 4
Name: da1da2da3ofme
Date: October 2, 2009 at 16:08:57 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: RunTime Error 424 Object Required, VB6.

VB Help www.computing.net/answers/programming/vb-help/10208.html

Objects and VB6 www.computing.net/answers/programming/objects-and-vb6/896.html

ftp transfer in visual basic 5 www.computing.net/answers/programming/ftp-transfer-in-visual-basic-5/16942.html