netnewb2002 Posted March 22, 2003 Posted March 22, 2003 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: 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, Quote
*Gurus* divil Posted March 22, 2003 *Gurus* Posted March 22, 2003 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? Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.