Globals issue

Discussion in 'Bug Reports' started by Cableguy, Dec 26, 2008.

  1. Cableguy

    Cableguy Expert Licensed User

    Hi..

    In Main Globals I setup a few of them...Globals
    But when I change their value within a module, the values are NOT updated...
    I was under the impression that Globals were shared by all modules...
    Is this a bug ?
    If Not, is there any workaraound without using the return KeyWord?
     
    Last edited: Dec 26, 2008
  2. klaus

    klaus Expert Licensed User

    Hi Paulo,

    Just a question, did you declare the variables as Public ?
    And if you use them in another module the variable name must have the module name at the beginning seperated by a dot.
    If you declare a variable in the Main module like
    Public TestVariable
    its name is
    Main.TextVariable
    in the other modules.
    The same rule is valid for Subroutines and Controls.

    Best regards and wishes for 2009.
     
    Last edited: Dec 26, 2008
  3. specci48

    specci48 Well-Known Member Licensed User

    Hi Cableguy,

    according to Erels description (...next-version-new-features...) every module has (per default) its own global variables. If you want to use some or all of them within all modules you have to define them as public and access them in connection with the module prefix.


    specci48

    edit: ups ... this answer was too slow for Klaus... ;-)
     
    Last edited: Dec 26, 2008
  4. Cableguy

    Cableguy Expert Licensed User

    Yes, I tryed to make them public but I either get an index out of range or a syntax error...
    I tryed using:
    Code:
    Public Myfile=""
    Doesn't Work

    IT NOW WORKS....

    My mistake was to declare the variable and at the same time set its value...
    THAT DOESN'T WORK
    What works is to declare the variable as Public
    Code:
    Public MyFile
    And AFTER that set its value
    Code:
    MyFile=""
     
    Last edited: Dec 26, 2008
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice