Jump to content
×
×
  • Create New...

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

  • Bu Alana Reklam Verebilirsiniz
    Bu Alana Reklam Verebilirsiniz

Dört İşlem Yapabilen Hesap Makinesi Örneği ve Kodları | ASP.NET

Rate this topic


serverIR

Recommended Posts

Dört İşlem Yapabilen Hesap Makinesi Örneği ve Kodları | ASP.NET
  • Members

Bu yazımızda ASP.NET’ te hesap makinesi oluşturan örneği oluşturacağız. Örneğimizde oluşturacağımız hesap makinesi aşağıdaki gibi olacaktır.

asp_hesap_makinesi_1.webp

 

Projemize ait WebForm1.aspx dosyası:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication3.WebForm1" %>
 
<!DOCTYPE html>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>www.yazilimkodlama.com</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:Panel ID="Panel1" runat="server" GroupingText="Hesap Makinesi"
            Width="280px">
            <table class="style1">
                <tr>
                    <td colspan="4">
                        <asp:TextBox ID="TextBox1" runat="server" Height="60px" Width="250px"
                            CssClass="kutu"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button ID="Button16" runat="server" Height="60px" Text="C" Width="60px" OnClick="Button16_Click"  />
                    </td>
                    <td>
                        <asp:Button ID="Button10" runat="server" Height="60px" 
                            Text="/" Width="60px" OnClick="Button10_Click" />
                    </td>
                    <td>
                        <asp:Button ID="Button11" runat="server" Height="60px" 
                            Text="*" Width="60px" OnClick="Button11_Click" />
                    </td>
                    <td>
                        <asp:Button ID="Button12" runat="server" Height="60px" 
                            Text="-" Width="60px" OnClick="Button12_Click" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button ID="Button7" runat="server" Height="60px" 
                            Text="7" Width="60px" OnClick="Button7_Click" />
                    </td>
                    <td>
                        <asp:Button ID="Button8" runat="server" Height="60px" 
                            Text="8" Width="60px" OnClick="Button8_Click" />
                    </td>
                    <td>
                        <asp:Button ID="Button9" runat="server" Height="60px" 
                            Text="9" Width="60px" OnClick="Button9_Click" />
                    </td>
                    <td rowspan="2">
                        <asp:Button ID="Button13" runat="server" Height="120px" 
                            Text="+" Width="60px" OnClick="Button13_Click" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button ID="Button4" runat="server" Height="60px" 
                            Text="4" Width="60px" OnClick="Button4_Click" />
                    </td>
                    <td>
                        <asp:Button ID="Button5" runat="server" Height="60px" 
                            Text="5" Width="60px" OnClick="Button5_Click" />
                    </td>
                    <td>
                        <asp:Button ID="Button6" runat="server" Height="60px" 
                            Text="6" Width="60px" OnClick="Button6_Click" />
                    </td>
                </tr><!--http://www.yazilimkodlama.com/ -->
                <tr>
                    <td>
                        <asp:Button ID="Button1" runat="server" Height="60px" 
                            Text="1" Width="60px" OnClick="Button1_Click" />
                    </td>
                    <td>
                        <asp:Button ID="Button2" runat="server" Height="60px" 
                            Text="2" Width="60px" OnClick="Button2_Click" />
                    </td>
                    <td>
                        <asp:Button ID="Button3" runat="server" Height="60px" 
                            Text="3" Width="60px" OnClick="Button3_Click" />
                    </td><!--http://www.yazilimkodlama.com/ -->
                    <td rowspan="2">
                        <asp:Button ID="Button14" runat="server" Height="120px"
                            Text="=" Width="60px" OnClick="Button14_Click" />
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        <asp:Button ID="Button15" runat="server" Height="60px" 
                            Text="0" Width="199px" OnClick="Button15_Click" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
     
    </div>
    </form>
</body>
</html>

 

Örneğimize ait WebForm1.aspx.cs kodları:

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace WebApplication3
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        static double a, b;
        static string d;
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "")
            { TextBox1.Text = "1"; }
            else
            { TextBox1.Text = TextBox1.Text + "1"; }
        }
        protected void Button15_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "")
            { TextBox1.Text = "0"; }
            else
            { TextBox1.Text = TextBox1.Text + "0"; }
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "")
            { TextBox1.Text = "2"; }
            else
              //http://www.yazilimkodlama.com/
            { TextBox1.Text = TextBox1.Text + "2"; }
        }
        protected void Button3_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "")
            { TextBox1.Text = "3"; }
            else
            { TextBox1.Text = TextBox1.Text + "3"; }
        }
        protected void Button4_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "")
            { TextBox1.Text = "4"; }
            else
            { TextBox1.Text = TextBox1.Text + "4"; }
        }
        protected void Button5_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "")
            { TextBox1.Text = "5"; }
            else
            { TextBox1.Text = TextBox1.Text + "5"; }
        }
        protected void Button6_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "")
            { TextBox1.Text = "6"; }
            else
            { TextBox1.Text = TextBox1.Text + "6"; }
        }
        protected void Button7_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "")
            { TextBox1.Text = "7"; }
            else
              //http://www.yazilimkodlama.com/
            { TextBox1.Text = TextBox1.Text + "7"; }
        }
        protected void Button8_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "")
            { TextBox1.Text = "8"; }
            else
            { TextBox1.Text = TextBox1.Text + "8"; }
        }
        protected void Button9_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "")
            { TextBox1.Text = "9"; }
            else
            { TextBox1.Text = TextBox1.Text + "9"; }
        }
        protected void Button13_Click(object sender, EventArgs e)
        {
            d = "+";
            a = Convert.ToInt16(TextBox1.Text);
            TextBox1.Text = "";
        }
        protected void Button12_Click(object sender, EventArgs e)
        {
            d = "-";
            a = Convert.ToInt16(TextBox1.Text);
            TextBox1.Text = "";
        }
        protected void Button11_Click(object sender, EventArgs e)
        {
            d = "*";
            a = Convert.ToInt16(TextBox1.Text);
            TextBox1.Text = "";
        }
        protected void Button10_Click(object sender, EventArgs e)
        {
            d = "/";
            a = Convert.ToInt16(TextBox1.Text);
            TextBox1.Text = "";
            //http://www.yazilimkodlama.com/
        }
        protected void Button14_Click(object sender, EventArgs e)
        {
            b = Convert.ToInt16(TextBox1.Text);
 
            if (d == "+")
                TextBox1.Text = Convert.ToString(a + b);
            if (d == "-")
                TextBox1.Text = Convert.ToString((sbyte)(a - b));
            if (d == "*")
                TextBox1.Text = Convert.ToString(a * b);
            if (d == "/")
                TextBox1.Text = Convert.ToString(a / b);
        }
 
        protected void Button16_Click(object sender, EventArgs e)
        {
            TextBox1.Text = "";
        }
    }
}

 

Edited by serverIR

----------------------------------------------------------------------------

Link to comment
https://weblep.com/topic/202-d%C3%B6rt-i%CC%87%C5%9Flem-yapabilen-hesap-makinesi-%C3%B6rne%C4%9Fi-ve-kodlar%C4%B1-aspnet/
Share on other sites


Konu Altı Reklam 1
Konu Altı Reklam 2
  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...