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); }
private void FrmEntry_OnCreate(Berhitung ber) { HasilCal.Items.Add("Hasil " + ber.Nama + " " + ber.Nilai_A + " " + ber.Operasi + " " + ber.Nilai_B + " " + "=" + " " + ber.Hasil); }
private void FrmAnak_OnCreate(Berhitung ber) { }