1
Reply

or "||" operator problems ?

Hassaan Qureshi

Hassaan Qureshi

Jan 17 2015 3:37 AM
615
 private void button1_Click(object sender, EventArgs e)
        {

            if (radioButton1.Checked || radioButton2.Checked || radioButton3.Checked)
            {
                int tp=0;
                if (j == "No")
                {
                    if (radioButton1.Checked)
                    {
                        tp = obje.get_economyprice();
                    }
                    if (radioButton2.Checked)
                    {
                        tp = obje.get_firstprice();
                    }
                    if (radioButton3.Checked)
                    {
                        tp = obje.get_businessprice();
                    }
                }

                else if (j == "Yes")
                {
                    normal_price obj = new employee_price();
                    if (radioButton1.Checked)
                    {
                        tp = obj.get_economyprice();

                    }
                    if (radioButton2.Checked)
                    {
                        tp = obj.get_firstprice();
                    }
                    if (radioButton3.Checked)
                    {
                        tp = obj.get_businessprice();
                    }
                    
                }
                Form3 objd = new Form3(tp, m, l);
                objd.Show();
                this.Hide();
            }
            else if (!radioButton3.Checked && !radioButton2.Checked && !radioButton1.Checked)
            {
                MessageBox.Show("Please select any class");
            }
            
        }
    }

i have these if statements in my button1click event when ever i debug and one of the radiobutton is checked even then it shows messagebox with error ?
please help


Answers (1)