Sunday, January 14, 2018

Birth Date Calculation


Default.aspx.vb

Partial Class _Default
    Inherits System.Web.UI.Page
public un as string
public bdt,cdt as date
public dy,yy as integer
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
un=request.form("T1")
bdt=request.form("T2")
cdt=Now()
dy=Datediff("d",bdt,cdt)
yy=Datediff("yyyy",bdt,cdt)
 End Sub
End Class



DEFAULT.ASPX
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        ENTER YOUR NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="T1" runat="server" Width="204px"></asp:TextBox>
        <br />
        ENTER YOUR BIRTHDATE&nbsp;
        <asp:TextBox ID="T2" runat="server" Width="204px"></asp:TextBox>
        <br />
        <asp:Button ID="Button1" runat="server" Text="CALCULATE" Width="245px" />
        <br />
        <br />

    </div>
    </form>
<p><%  Response.Write("hi " & un & "<br>")
       Response.Write("your birthdate is  " & bdt & "<br>")
       Response.Write("Todays  date  is " & cdt& "<br>")
       Response.Write("you have lived on this beautiful earth for precious " & dy & "  days" & "<br>")
 Response.Write("you have lived on this beautiful earth for precious " & yy & "  years" )
       %></p>

</body>
</html>


No comments:

Post a Comment