Page init and load event (VB.net) : Page Init « Page « ASP.Net






Page init and load event (VB.net)

<script language="vb" runat="server">
Dim intGlobal As Integer = 0
Sub Page_Init()
  intGlobal=intGlobal+1
  Message1.Text += "<br>Page_Init has called this line at " & Now() & _
                            " with the value of intGlobal being :" & intGlobal
End Sub
Sub Page_Load()
  intGlobal=intGlobal+1
  Message2.Text += "<br>Page_Load has called this line at " & Now() & _ 
                            " with the value of intGlobal being :" & intGlobal
End Sub

</script>
<html>
<head>
  <title>Automatic Events Example</title>
</head>
<body>
<form runat="server">
  <input type="submit" value="Click to continue">
  <br /> 
  <asp:label id="message1" runat="server"/>
  <asp:label id="message2" runat="server"/>
</form>
</body>
</html>

           
       








Related examples in the same category

1.Page Event: init (C#)