Storing in Radio Buttons

netnewb2002

Newcomer
Joined
Sep 17, 2002
Messages
13
Location
Wisconsin
I'm making a quesiton/answer based program. I have about everything working on it except for this...

How do I store values inside radio buttons?

For example, What I would like to do is:

After chosing an answer for the previous question, and going to the next question, chosing another answer for that question.

Then going back to the previous question, and I would like to have it to show what I answered for that question, and vise versa.

Almost everything I tried gave an error, and forced me to exit the program, heh. Here's what I've tried, hopefully, I'm not too far off.


I set variables:

Visual Basic:
 dim a, b, c as string 'This one didn't work, on the next question, it changed previoius answers.

   if rdoA.checked=true then
      a="A"
  Else
     If rdoB.checked= true then
        b="B"
     Else
        if rdoC.checked=true then
          c="C"
     end if
   end if

'I tried just reversing the check state, didn't work though, it made each of them selected continuously.

dim a as string="A"
dim b as string="B"

if a="A" then
   rdoA.checked=true
Else
   rdoB.checked=false

'Tried to nest it into my if statements, that gave the microsoft send error report message., had to exit program.

dim x as integer

     'i have statements here for the list box//question//answer//valadation checks arrays

     'tried using same code from above
if x <4then
   if x=0 then
     if rdoA.checked=true then
          a="A"
     Else
       If rdoB.checked= true then
            b="B"
       Else
           if rdoC.checked=true then
             c="C"
       end if
     end if
  end if
end if

Any ideas of what I might do differently? Links//Help would be appreciated.

Thanks,
 
The RadioButton class has a Tag property you could use to store information in. I don't really understand why you need to store answers, it looks like you're using different radio buttons for each question so presumably they retain their state anyway?
 
Back
Top