Click here to Skip to main content
16,018,802 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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();
        }
    }
}
Posted
Comments
Richard MacCutchan 19-Dec-14 5:41am    
Why not show the code where the error message appears? And please indicate the exact line also.
Sinisa Hajnal 19-Dec-14 5:47am    
There is no Application used in the code you're showing.
Is it a Web Application?

1 solution

Are You Using it in web application or console application ??
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900