Results 1 to 9 of 9

Thread: [RESOLVED] Option Explicit Ignored

  1. #1

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Resolved [RESOLVED] Option Explicit Ignored

    Ok, a really weird one.

    I just installed the IDE on a Win10-64 machine (yeah, we've got plenty of licenses), I fire up a new project, start a new BAS module, and then type this:

    Code:
    Option Explicit
    
    Sub Test()
        asdfasdf = 5
    End Sub
    And I've also made sure the "Background Project Load" is NOT on.

    But the project still runs. What's the deal? Anyone seen this.

    Thanks In Advance,

    Elroy

    EDIT1: I feel like I'm losing it when I see these things.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  2. #2
    Hyperactive Member
    Join Date
    Jan 2018
    Posts
    264

    Re: Option Explicit Ignored

    But Compile on Demand is turned on, right? Is that module actually called anywhere?
    Also, Ctrl-f5 would probably catch it even if the regular IDE run missed it. I've had plenty of bad code get temporarily accepted if I'm not doing a full compile yet.
    Last edited by ahenry; Oct 15th, 2019 at 03:15 PM.

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

    Re: Option Explicit Ignored

    ahenry beat me to it. It won't trigger unless the routine is entered or "Start With Full Compile"
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Option Explicit Ignored

    Ok, no, the Sub Test is not being called anywhere.

    But, I'm still confused on a couple of counts.

    For one, I thought turning OFF the "Compile On Demand" was the same as forcing a "Start With Full Compile". In other words, if "Compile On Demand" is off, F5 = Ctrl-F5.

    And, here's something even weirder. On my development laptop, I've got "Compile On Demand" turned OFF, and it won't run (p-code) or compile. And I compared every setting in Tools --> Options... and everything is exactly the same between the two machines.

    The VB6 IDE installation is acting a bit weird on the new computer. Occasionally when just firing up VB6, it'll hang. A Ctrl-Alt-Del and kill it, and then try again usually works. And it only hangs on occasion. But I've seen that before. In fact, that happens once in a blue moon on my development laptop.

    Still at a loss,
    Elroy

    And ohh, yes Ctrl-F5 does catch it on the new machine. So, clearly it's not doing a "Start With Full Compile" on this new machine.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  5. #5
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Option Explicit Ignored

    The background compile should only be available if compile on demand is turned on.
    If the compile on demand is turned off then I would expect it to behave as it does when starting with full compile.
    I am not sure I have ever set the option here as I like the quick run ability and full compile when desired, saves a lot of time when testing larger projects.

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Option Explicit Ignored

    VS/VB6 is licensed to the developer, not the machine.

    It can't be shared. If you have 100 programmers you need 100 licenses, even if you only have one PC.

  7. #7
    Member dseaman's Avatar
    Join Date
    Oct 2004
    Location
    Natal, Brazil
    Posts
    38

    Re: Option Explicit Ignored

    Have you installed SP6?

    Name:  Vb6AboutSP6.png
Views: 174
Size:  9.8 KB

  8. #8
    Fanatic Member
    Join Date
    Feb 2019
    Posts
    706

    Re: Option Explicit Ignored

    Have you compared the Add-ins, and which one is loaded? Maybe their order matter?

    Also, probably unrelated, but VB6 features function-level linking(verified by checking assembly output), which means that because your Sub Test is not being called from anywhere, the linker will not include its code in the EXE. However, I think you should have gotten a compile time error. You could try calling it and see if that makes any difference.

  9. #9

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Option Explicit Ignored

    Quote Originally Posted by dilettante View Post
    VS/VB6 is licensed to the developer, not the machine.

    It can't be shared. If you have 100 programmers you need 100 licenses, even if you only have one PC.
    I get so tired of self-appointed policing. I hold at least 4 licenses to VB6, and the client I'm at holds 2 of his own. And, there are only two of us that are programmers. So, I believe the license issue is covered. It's like that case in Florida where the guy just got convicted for shooting another guy who shoved him over a handicapped parking space. The judge made the declaration that handicapped parking signs are only for two groups of people, the person parking in the spot and the police, and that nobody else needs to worry about them. Therefore, Dil, if you're worried about my VB6 licenses, please report my post to VBForums, or my license usage to Microsoft.

    Now, if we can get back on topic...

    @dseaman: Yes, I always install SP6 immediately after any VB6 IDE installation.

    @DataMiser: I'm not sure I know where to ... wait, you solved the problem. I was getting "Background Project Load" confused with "Compile On Demand" in the options. I've now got "Compile On Demand" turned off, and everything is working as desired. Thank You!

    -----

    Ok, all resolved now.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

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