Local variable inside a function (VB.net) : Variable Scope « Language Basics « ASP.Net






Local variable inside a function (VB.net)

<script language="vb" runat="server"> 
Sub Page_Load()  
    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)
  End Sub

  Sub Subroutine_2()
    Dim Different As String
    Different = "<b>Hello I'm the variable Different in Subroutine 2</b>"
    Response.Write (Different)
  End Sub
</script>
<html>
<head>
<title>Scope</title>
</head>
<body>
</body>
</html>

           
       








Related examples in the same category

1.Page level variable and function level variable (VB.net)
2.Define page level variables (VB.net)
3.Function Level variables (C#)
4.Page Level Variable (C#)
5.block-level variables (C#)