Microsoft Silverlight – Create a global variable to keep track of which page you are on

This is my example of creating a global variable that keeps track of which page I am on.

Created a class clsApplicationGlobal.vb

Public NotInheritable Class clsApplicationGlobal
   Public Shared HoldThePage As String
End Class

In each form, I put the following code:

Public Sub New()
   InitializeComponent()
   clsApplicationGlobal.HoldThePage = "Item"
End Sub

I can then test for where I am anywhere in the app using the following code:

If clsApplicationGlobal.HoldThePage = "Item" Then

Leave a Reply