<%@ Page Language="VB" %>
<script runat="server">
Dim myFirstNumber, mySecondNumber As Integer
Sub SetVarsToInitialValues()
myFirstNumber = 7
mySecondNumber = 8
Label1.Text = myFirstNumber
Label2.Text = mySecondNumber
End Sub
Sub Button1_Click(sender As Object, e As EventArgs)
SetVarsToInitialValues()
Label3.Text = myFirstNumber + mySecondNumber
End Sub
Sub Button2_Click(sender As Object, e As EventArgs)
SetVarsToInitialValues()
Label3.Text = myFirstNumber - mySecondNumber
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p>
<asp:Label id="Label1" runat="server">Label</asp:Label>
+
<asp:Label id="Label2" runat="server">Label</asp:Label>
=
<asp:Label id="Label3" runat="server">Label</asp:Label>
</p>
<p>
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Add"></asp:Button>
<asp:Button id="Button2" onclick="Button2_Click" runat="server" Text="Subtract"></asp:Button>
</p>
</form>
</body>
</html>
|