Page level variable and function level variable (VB.net)
<script language="vb" runat="server"> Dim Global As String ="<br><u>Hello I'm a persistent global variable</u>" Sub Page_Load() Response.Write (Global) Response.Write ("<BR />Calling Subroutine 1...") Call Subroutine_1() Response.Write ("<BR />Calling Subroutine 2...") Call Subroutine_2() Response.Write ("<BR />Calling Subroutine 1...") Call Subroutine_1() End Sub Sub Subroutine_1() Dim Different As String Different = "<i>Hello I'm the variable Different in Subroutine 1</i>" Response.Write (Different) Response.Write (Global) End Sub Sub Subroutine_2() Dim Different As String Different = "<b>Hello I'm the variable Different in Subroutine 2</b>" Response.Write (Different) Response.Write (Global) End Sub </script> <html> <head> <title>Scope</title> </head> <body> </body> </html>
1. | Local variable inside a function (VB.net) | ||
2. | Define page level variables (VB.net) | ||
3. | Function Level variables (C#) | ||
4. | Page Level Variable (C#) | ||
5. | block-level variables (C#) |