Wednesday, 22 May 2013

C# Hotel Menu Windows form application

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 bb
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            comboBox1.Items.Add("Pizza");
            comboBox1.Items.Add("bread");
            comboBox1.Items.Add("cake");
            comboBox1.Items.Add("All");

        }

        private void button1_Click(object sender, EventArgs e)
        {
            int x = 0;
            if (comboBox1.SelectedIndex == 0)
            {
                MessageBox.Show("pizza","Correct option is choosed");
            if (checkBox1.Checked == true)
            {
                x += 500;
          
            }
            checkBox2.Visible = false;
            checkBox3.Visible = false;
            if (checkBox2.Checked == true)
            {
                MessageBox.Show("Please choose Another one","Wrong Options");

            } if (checkBox3.Checked == true)
            {
                MessageBox.Show("Please choose Another one", "Wrong Options");

            }

            }


            if (comboBox1.SelectedIndex == 1)
            {
                if (checkBox1.Checked == true)
                {
                    MessageBox.Show("Please choose Another one", "Wrong Options");
                    checkBox1.Visible = false;
                }
            
                if (checkBox2.Checked == true)
                {
                    MessageBox.Show("bread is choosed");
                    x += 40;

                }
              
                if (checkBox3.Checked == true)
                {
                    checkBox3.Visible = false;
                    MessageBox.Show("Please choose Another one", "Wrong Options");

                }
            }
            if (comboBox1.SelectedIndex == 2)
            {
                if (checkBox1.Checked == true)
                {
                    MessageBox.Show("Please choose Another one", "Wrong Options");

                }
                if (checkBox2.Checked == true)
                {
                    MessageBox.Show("Please choose Another one", "Wrong Options");

                }
                if (checkBox3.Checked == true)
                {
                    MessageBox.Show("Cake is choosed");
                    x += 300;

                }
            }
            if (comboBox1.SelectedIndex == 3)
            {
                if (checkBox1.Checked == true)
                {

                    x += 500;
                }
                if (checkBox2.Checked == true)
                {
                    x += 40;

                }
                if (checkBox3.Checked == true)
                {
                 
                    x += 300;

                }
            }


            textBox1.Text = x.ToString();
        }
     
    }
}


No comments:

Post a Comment