Create an application that obtains four int values from the user and displays the product.

 default.aspx file 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="1a.aspx.cs" 

Inherits="StringOperation._1a" %> 

<!DOCTYPE html> 

<html xmlns="http://www.w3.org/1999/xhtml"> 

<head runat="server"> 

    <title></title> 

</head> 

<body> 

    <form id="form1" runat="server"> 

        <div> 

            Enter a  :<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 

            <br /> 

            <br /> 

        </div> 

        Enter b :<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> 

        <p> 

            Enter c :<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> 

        </p> 

        Enter d :<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox> 

        <p> 

            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Result" /> 

        </p> 

        <p> 

            <asp:Label ID="Label1" runat="server" Text=""></asp:Label> 

        </p> 

    </form> 

</body> 

</html> 

default.aspx.cs file 

using System; 

using System.Collections.Generic; 

using System.Linq; 

using System.Web; 

using System.Web.UI; 

using System.Web.UI.WebControls; 

namespace StringOperation 

    public partial class _1a : System.Web.UI.Page 

    { 

        protected void Page_Load(object sender, EventArgs e) 

        { 

        } 

        protected void Button1_Click(object sender, EventArgs e) 

        {             int r; 

            r = Convert.ToInt32(TextBox1.Text) * Convert.ToInt32(TextBox2.Text) * 

            Convert.ToInt32(TextBox3.Text) * Convert.ToInt32(TextBox4.Text); 

            Label1.Text = "Result :" + r.ToString(); 

        } 

    } 

Output :- 



Post a Comment

0 Comments