Need help with checkbox control array

Trying to create a simple true/false test questions (about 50 questions)
Working with 2 checkboxes true/false as answer for a question.
Made the 2 checkboxes into a control array. But is having problem alternating the check between the 2 boxes with the following code:
if (CheckBox3(0).Value = True) And (CheckBox3(1).Value = True) then
CheckBox3(1).Value = False
TextField1.Text = “True”
if (CheckBox3(1).Value = True) And (CheckBox3(0).Value = True) then
CheckBox3(0).Value = False
TextField1.Text = “False”


You probably want something like

dim n as integer
if Index = 0 then n = 1 else n = 0     // index of  the other checkbox
if me.Value = True then
   CheckBox3(n).Value = false

Thank you very much.
Is there any way of creating random question with the checkbox function attached to it?

Thank you very much.

Do you know that this is what a radiobutton is for?
Put two on a screen
Set the text to be

And the code is already done for you.
All you need to do to see if someone answered TRUE is to look at the .VALUE property of the one labelled True

Have an array of the questions, which end with |T or |F based on what the answer is.
Randomly select one of the array.
Display the text up to the | character, and remember the last character.
Disply the radiobuttons, and a SUBMIT button (allows people to change their mind before committing)

You can get a random item from the array by making use of Rnd()
Or you can shuffle the array using Array_of_Questions.Shuffle
And then work from the start to the end of the array.

The only problem with a radio button is that each pair would have to be on a separate parent control. That seemed more complicated to explain than simply tweaking the code.

[quote=397568:@Benny Lee]Thank you very much.
Is there any way of creating random question with the checkbox function attached to it?

Thank you very much.[/quote]
Time to look at ContainerControl. That would allow you to package up the controls and logic into a self contained package that can be added at runtime, as many as you need. You should at that point use RadioButtons, as Jeff recommends.

Im not picking up that there will be more than one question visible at once.

If there is, container controls would be ideal for that, holding 2 radios and the text.
Then use an array of such containers.
(edit… like you just said, Tim… :> )

Also dead simple using a listbox with a checkbox control in one of the columns.

A lot depends on the UX, but based on the variable names above, I think that may still be ‘TODO’