SIMPLE CALCULATOR APP

Dibawah ini adalah contoh aplikasi kalkulator sederhana menggunakan bahasa C#. Pembuatan ini dilakukan dengan memanfaatkan fitur Windows Forms App yang tersedia pada .NET Framewok melalui Microsoft Visual Studio.

Berikut hasil aplikasi kalkulator sederhana.





Berikut source code 'behavior' dari aplikasi kalkulator sederhana.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CalculatorApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            int nilai1 = int.Parse(textBox1.Text);
            int nilai2 = int.Parse(textBox2.Text);
            int hasil = nilai1 / nilai2;
            textBox3.Text = hasil.ToString();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button5_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
        }

        private void button4_Click(object sender, EventArgs e)
        {
            int nilai1 = int.Parse(textBox1.Text);
            int nilai2 = int.Parse(textBox2.Text);
            int hasil = nilai1 + nilai2;
            textBox3.Text = hasil.ToString();
        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }

        private void button3_Click(object sender, EventArgs e)
        {
            int nilai1 = int.Parse(textBox1.Text);
            int nilai2 = int.Parse(textBox2.Text);
            int hasil = nilai1 - nilai2;
            textBox3.Text = hasil.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            int nilai1 = int.Parse(textBox1.Text);
            int nilai2 = int.Parse(textBox2.Text);
            int hasil = nilai1 * nilai2;
            textBox3.Text = hasil.ToString();
        }
    }
}

Comments

Popular posts from this blog

CONTOH 'SYSTEM REQUEST' : WARTEG DIGITAL

PWEB - ETS - HTML, CSS, JAVASCRIPT, BOOTSTRAP