using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace menuForm { public partial class Form3 : Form { private void calculatefee() { int coursefee; switch(cmbcourse.SelectedIndex) { case 0:coursefee=7500; break; case 1:coursefee=6000; break; case 2:coursefee=4000; break; case 3:coursefee=3000; break; default:MessageBox.Show("please select a course!","Error"); cmbcourse.Focus(); return; } if(rbafternoon.Checked) coursefee=coursefee*80/100; else if(rbmorning.Checked) coursefee=coursefee*90/100; if(chkcoursematerial.Checked) coursefee+=500; lblfee.Text=coursefee.ToString(); } private void rbmorning_CheckedChanged(object sender, EventArgs e) { calculatefee(); } private void rbafternoon_CheckedChanged(object sender, EventArgs e) { calculatefee(); } private void rbevening_CheckedChanged(object sender, EventArgs e) { calculatefee(); } private void chkcoursematerial_CheckedChanged(object sender, EventArgs e) { calculatefee(); } private void cmbcourse_SelectedIndexChanged(object sender, EventArgs e) { calculatefee(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)