title: Visual Basic: Check Boxes with Random Number Generators
body: <p>I am trying to code a mathematical calculator which has levels (or stages) I have 5 checkboxes, only one can be checked at one time. I can not find a way to code a way that I can check if the checkbox is checked and then preform a random number generator. Please help me. This is my code: </p>
  
  <pre><code> If Stage1.Checked = True Then
              Randomize()
              Random1 = Int(Rnd() * 5) + 1
              Randomize()
              Random2 = Int(Rnd() * 5) + 1
              Random1 = q1.Text
              Random2 = q2.Text
          ElseIf Stage2.Checked = True Then
              Randomize()
              Random1 = Int(Rnd() * 6) + 1
              Randomize()
              Random2 = Int(Rnd() * 6) + 1
              Random1 = q1.Text
              Random2 = q2.Text
          ElseIf Stage3.Checked = True Then
              Randomize()
              Random1 = Int(Rnd() * 9) + 1
              Randomize()
              Random2 = Int(Rnd() * 9) + 1
              Random1 = q1.Text
              Random2 = q2.Text
          ElseIf Stage4.Checked = True Then
              Randomize()
              Random1 = Int(Rnd() * 10) + 1
              Randomize()
              Random2 = Int(Rnd() * 10) + 1
              Random1 = q1.Text
              Random2 = q2.Text
          ElseIf Stage5.Checked = True Then
              Randomize()
              Random1 = Int(Rnd() * 12) + 1
              Randomize()
              Random2 = Int(Rnd() * 12) + 1
              Random1 = q1.Text
              Random2 = q2.Text
          Else
              MessageBox.Show("Please Select a Stage.")
          End If
  </code></pre>