<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
lblTitle.Text = "Odd or Even Page"
End Sub
Sub SubmitBtn_Click(Sender As Object, E As EventArgs)
lblMessage2.Text = "number entered: " & OddOrEven(txtNumber.Text)
End Sub
Function OddOrEven(TheNumber as Long) as String
If TheNumber Mod 2 = 0 Then
OddOrEven = "even."
Else
OddOrEven = "odd."
End If
End Function
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Odd Or Even Sample Page</TITLE>
</HEAD>
<BODY>
<form runat="server">
<Font Face="Tahoma">
<asp:Label
id="lblTitle"
runat="server"
/>
<BR><BR><BR>
<asp:Label
id="lblMessage1"
runat="server"
Text="Enter a number"
/>
<asp:TextBox
id="txtNumber"
runat="server"
/>
<BR>
<asp:button
id="butOK"
text="OK"
Type="Submit"
OnClick="SubmitBtn_Click"
runat="server"
/>
<BR><BR>
<asp:Label
id="lblMessage2"
runat="server"
/>
</Font>
</Form>
</BODY>
</HTML>
|