Wednesday, April 23, 2014

Radio Button Exercise 1



namespace Zau_RadioButton_Exercise
{

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnGetSelection_Click(object sender, EventArgs e)
        {
            string tea = String.Empty;
            if (radGreenTea.Checked)
                tea = "Green Tea";
            else if (radBlackTea.Checked)
                tea = "Black Tea";
            else if (radChaiTea.Checked)
                tea = "Chai Tea";

            string coffee = String.Empty;
            if (radCappuccino.Checked)
                coffee = "Cappuccino";
            else if (radChaiLatte.Checked)
                coffee = "Chai Latte";
            else if (radMocha.Checked)
                coffee = "Mocha Pot Coffee";

            richTextBox1.Text = "Selected Items: \n" + tea + "\n" + coffee;
        }
    }
}

No comments:

Post a Comment