locked
How to use global variables? RRS feed

  • Question

  • Hi there,

    I am trying to declare global variables in a Windows Store App using VB. I tried to declare the variable in the App-Class and then access it from the mainpage with app.MyGlobalInt (pretty much like what I used to do when coding .NET) but it doesn't work.

    NotInheritable Class App
        Inherits Application
    
        Public MyGlobalInt As Integer
    '...
    '..
    '.
    End Class
    

    Any ideas? ;o)

    Friday, November 23, 2012 5:33 PM

Answers

  • use:

    Public Shared MyGlobalInt As Integer


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    • Proposed as answer by sandørMVP Saturday, November 24, 2012 1:10 AM
    • Marked as answer by TheStoepsel2001 Saturday, November 24, 2012 8:11 AM
    Friday, November 23, 2012 5:40 PM

All replies

  • use:

    Public Shared MyGlobalInt As Integer


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    • Proposed as answer by sandørMVP Saturday, November 24, 2012 1:10 AM
    • Marked as answer by TheStoepsel2001 Saturday, November 24, 2012 8:11 AM
    Friday, November 23, 2012 5:40 PM
  • Thank you for your quick response! That works perfectly!!!
    Saturday, November 24, 2012 8:11 AM