Name
Get
Synopsis
Application.Get(ByVal name As String) Application.Get(ByVal Index As Integer)
Gets an element of the Application collection either by name or ordinal position (index) within the Application collection. Generally, the name is used in calls to Get unless you need to get members of the collection inside a loop.
Parameters
-
name A variable of type String that specifies the name of the item to be retrieved from the Application collection.
-
Index A variable of type Integer that specifies the index of the item to be retrieved from the Application collection.
Example
The example below sets and gets a value from the Application collection. It also uses the Get method to write a message to the Text property of the Message control that includes the current value of the newly added element of the Application collection.
Sub Page_Load( )
Application("GetTest") = "Got it!"
Message.Text = "GetTest = " & Application.Get("GetTest")
End SubNotes
You can see whether a named value is saved in the Application collection by checking to ensure that its value is not null, as shown in the following code:
If Not Application("Foo") is Nothing then
Message.Text = "Foo is set to " & Application.Get("Foo")
End IfBecome an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access