Monday 2 June 2014

asp.net 4:Even or Odd

program to Check Whether Number is Even or Odd.

-----------------------------------------DESIGN-----------------------------------------------------


<%@ 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">
    <p style="font-family: Calibri; text-decoration: underline; color: #800000; font-size: xx-large;">
        Even Odd
    </p>
    <div>
    </div>
    <asp:Label ID="Label1" runat="server" Text="Enter Number"></asp:Label>
    <asp:TextBox ID="TextBox1" runat="server" style="margin-left: 15px"></asp:TextBox>
    <p><br />
        <asp:Button ID="Button1" runat="server" Text="Ok" Width="60px" />
    </p>
    </form>
</body>
</html>
-----------------------------------------code---------------------------------------------------------

Partial Class _Default
    Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As                                             System.EventArgs) Handles Button1.Click
        Dim a As Integer
        a = TextBox1.Text
        If a Mod 2 = 0 Then
            MsgBox("Number is even", , "Message")
        Else
            MsgBox("Number is odd", , "Message")
        End If
    End Sub
End Class

-----------------------------------------output----------------------------------------------------




umesh sohaliya
codestrew

No comments:

Post a Comment