Imports ClassLibraryDemoTest
Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Private Function Factorial(ByVal n As Integer)
If (n = 0) Then
Factorial = 1
Else
Factorial = n * Factorial(n - 1)
End If
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn.Click
Dim n As Integer
n = Integer.Parse(TextBox1.Text)
Label1.Text = Factorial(n).ToString()
End Sub
End Class
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="ClassLibraryDemoTest._Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<fieldset style="width:380px; background-color:antiquewhite">
Enter Number: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="btn" runat ="server" Text="Factorial" OnClick ="Page_Load"/>  
<asp:Label ID="Label1" runat="server" Text =""></asp:Label>
</fieldset>
</div>
</form>
</body>
</html>