Results 1 to 6 of 6

Thread: 6.0 Global Help

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    1

    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.

  2. #2
    Hyperactive Member
    Join Date
    Aug 2006
    Location
    TeXaS
    Posts
    497

    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

  3. #3
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: 6.0 Global Help

    If it is not an object, then dont use Set. just blnLeaderBoard=true

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.

  5. #5
    Frenzied Member
    Join Date
    Dec 2007
    Posts
    1,072

    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

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width