Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8884063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:58:25+00:00 2026-06-14T20:58:25+00:00

Hi I’m developing a simple -multiple choices- quiz program using visual studio. (C#) I

  • 0

Hi I’m developing a simple -multiple choices- quiz program using visual studio. (C#)

I want to make the choices with radio buttons, in which each radio button has a – randomly selected answer- and one of them is the correct one.

I filled an array with the all possible answers.
And I want to know how can I make the right answer not in the same place every time?

so how can I make the right answer goes for a random place? and the other places selects other random numbers from the array which are not the right one. 😀

I know my question is not that clear I don’t know how to explain. ><

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:58:27+00:00Added an answer on June 14, 2026 at 8:58 pm

    First, select your right answer, then randomly select an index and assign your right answer to the random radio button.

    Fill the other radio buttons with random answers.

    Tip: store your radio buttons in an list to facilitate this operation. You begin by filling the list with all your radio buttons, then remove them from the list when they’re filled with an answer, this way you don’t have to handle “which index did I put the right answer in” or “complicated code that references manually the controls by name”

    Edit: As pointed out by Alexei Levenkov in another answer, see this thread for more information on how to generate random numbers properly

    Assuming a Random random declared in your app

    List<RadioButton> buttons = new List<RadioButton>();
    buttons.Add(answer);
    buttons.Add(answer2);
    buttons.Add(answer3);
    buttons.Add(answer4);
    
    int goodAnswerPos = random.Next(buttons.Count);
    buttons[goodAnswerPos].Text = "Good Answer";
    buttons.RemoveAt(goodAnswerPos);
    
    foreach (RadioButton button in buttons)
    {
        button.Text = "Randomly Selected Wrong Answer";
    }
    

    Storing the control at buttons[goodAnswerPos] will allow you to know if the user selected the right one when he submits the answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I am reading a book about Javascript and jQuery and using one of the
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.