Program kalkulator sederhana windows form



Kali ini saya akan membagikan kode source program kalkulator sederhana yang berbasis gui yang memakai windows form application menggunakan bahasa c#.

program saya buat ini sebagai media pembelajaran membuat kalkulator berbasis gui berikut adalah source code aplikasi kalkulatornya :

source code :

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 WindowsFormsApplication4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void tambahToolStripMenuItem_Click(object sender, EventArgs e)
        {
            double angka = Convert.ToInt16(txt1.Text);
            double angka1 = Convert.ToInt16(txt2.Text);
            double jawab = angka + angka1;
            hasil.Text = Convert.ToString(jawab);
        }

        private void kurangToolStripMenuItem_Click(object sender, EventArgs e)
        {
            double angka = Convert.ToInt16(txt1.Text);
            double angka1 = Convert.ToInt16(txt2.Text);
            double jawab = angka - angka1;
            hasil.Text = Convert.ToString(jawab);
        }

        private void kaliToolStripMenuItem_Click(object sender, EventArgs e)
        {
            double angka = Convert.ToInt16(txt1.Text);
            double angka1 = Convert.ToInt16(txt2.Text);
            double jawab = angka * angka1;
            hasil.Text= Convert.ToString(jawab);
        }

        private void bagiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            double angka = Convert.ToInt16(txt1.Text);
            double angka1 = Convert.ToInt16(txt2.Text);
            double jawab = angka / angka1;
            hasil.Text = Convert.ToString(jawab);
        }
    }
}

Hasil source code di atas :



Previous
Next Post »