Random button and image display based with radio button

I’m having trouble with my code, i’m trying to display a random number and with using radio buttonS. Here’s a picture of the design and I’m using visual studios. Can anyone help me with this? It seems so simple but yet so confusing. I have to used this all under private void GenerateDisplayProblem():
Here’s my code:

private void GenerateDisplayProblem()
{
//Random generater.

        Random rand = new Random();
        int num = rand.Next(1, 30);


        if (radLevel1.Checked)
        {
            num = rand.Next(1, 10);
        }
        if (radLevel2.Checked)
        {
            num = rand.Next(1, 20);
        }
        if (radLevel3.Checked)
        {
            num = rand.Next(1, 30);
        }


        lblNumber1.Text = num.ToString();
        lblNumber2.Text = num.ToString();


        //Operator image
    if (radAdd.Checked)
        {
            picOperator.Image = Image.FromFile("Plus.jpg");
        }
        if (radSubtraction.Checked)
        {
            picOperator.Image = Image.FromFile("Minus.jpg");
        }

        if (radMultiply.Checked)
        {
            picOperator.Image = Image.FromFile("Multiply.jpg")


    }


    private void btnCheckAnswer_Click(object sender, EventArgs e)
    {
        radLevel1.Enabled = false;
        radLevel2.Enabled = false;
        radLevel3.Enabled = false;

        radAdd.Enabled = false;
        radSubtraction.Enabled = false;
        radMultiply.Enabled = false;

Leave a Reply

Your email address will not be published. Required fields are marked *