Exemple #1
0
        private void btnProses_Click(object sender, EventArgs e)
        {
            ber         = new Berhitung();
            ber.Nama    = this.cmbOperasi.Text.ToLower();
            ber.Operasi = string.Empty;
            ber.Hasil   = 0;
            ber.Nilai_A = Double.Parse(this.textBox1.Text);
            ber.Nilai_B = Double.Parse(this.textBox2.Text);


            if (this.cmbOperasi.SelectedIndex == 0)
            {
                ber.Hasil   = ber.Nilai_A + ber.Nilai_B;
                ber.Operasi = "+";
            }
            else if (this.cmbOperasi.SelectedIndex == 1)
            {
                ber.Hasil   = ber.Nilai_A - ber.Nilai_B;
                ber.Operasi = "-";
            }
            else if (this.cmbOperasi.SelectedIndex == 2)
            {
                ber.Hasil   = ber.Nilai_A * ber.Nilai_B;
                ber.Operasi = "*";
            }
            else if (this.cmbOperasi.SelectedIndex == 3)
            {
                ber.Hasil   = ber.Nilai_A / ber.Nilai_B;
                ber.Operasi = "/";
            }

            this.OnCreate(ber);
        }
Exemple #2
0
 private void FrmEntry_OnCreate(Berhitung ber)
 {
     HasilCal.Items.Add("Hasil " + ber.Nama + " " + ber.Nilai_A + " " + ber.Operasi + " " + ber.Nilai_B + " " + "=" + " " + ber.Hasil);
 }
Exemple #3
0
 private void FrmAnak_OnCreate(Berhitung ber)
 {
 }