-
6.0 Global Help
Hey I'm using Visual Basic 6.0 and I have a Module to declare my global variables using the code: Public blnLeaderboard As Boolean
It seems that none of my globals are being made for some reason because when I try to make an exe program it says this Object Required. Then highlights the "blnLeaderboard ="
This is the full part of my setting if something is wrong: Set blnLeaderboard = True
Please help.
-
Re: 6.0 Global Help
this is wrong...
Code:
Set blnLeaderboard = True
Set is used for Objects, you should use the Let keyword instead.
Code:
Let blnLeaderboard = True
and by the way Let is optional...the following is equivalent
Code:
blnLeaderboard = True
-
Re: 6.0 Global Help
If it is not an object, then dont use Set. just blnLeaderBoard=true
-
Re: 6.0 Global Help
Welcome to the forujms. Two things
1. At the top of each code page (form, module, class, etc), add the words OPTION EXPLICIT. This will help catch easy/common errors in coding.
2. Booleans, Longs, Dates, and many other variable types are not objects. Use Set for objects else do not: bInLeaderboard=True, not Set.
-
Re: 6.0 Global Help
You don't need to use "Set".
This should work.
Public blnLeaderBoard As Boolean
Have that at the top of a FORM's code.
4 Responses as I was typing :)
-
Re: 6.0 Global Help
I you use the "Tools > Add Procedure..." menu item it will insert a template of properties for you if you select "property" and give it a name and scope. No way to write incorrect code that way. Simple too.