what i have done is copied answer in label and now matching the radiobutton option with it so far so good but i dont know how to uncheck radio button when i get to next question and method of mine stucks in between like sometime it just donot match the answer at all my code is below,. any other method that can help needed thanx

 if (radioButton1.Checked)
            {

                if (labelanswer.Text == radioButton1.Text.Trim())
                {

                    MessageBox.Show("right");

                    score = +score + 1;
                    labs.Text = score.ToString();

                }
                else if

                     (radioButton2.Checked)
                {

                    if (labelanswer.Text == radioButton2.Text.Trim())
                    {

                        MessageBox.Show("right");

                        score = +score + 1;
                        labs.Text = score.ToString();

                    }

                }
                else if

                    (radioButton3.Checked)
                {

                    if (labelanswer.Text == radioButton3.Text.Trim())
                    {

                        MessageBox.Show("right");

                        score = +score + 1;
                        labs.Text = score.ToString();

                    }
                    else if

                    (radioButton4.Checked)
                    {

                        if (labelanswer.Text == radioButton4.Text.Trim())
                        {

                            MessageBox.Show("right");

                            score = +score + 1;
                            labs.Text = score.ToString();

                        }

                    }

Recommended Answers

All 4 Replies

The radiobutton Checked property can be set to true or false in your program.

is there anyother way to match answers ?

Yes, perhaps something like this:

A question
1.answer 1
2.answer 2
3.answer 3

Then in a textbox let the user answer 1,2 or 3, process this answer further.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.