-2

Code in C#

Binary.frm_binaryQuesiton1.radioCheck.Checked = true;

So here's the problem, I'm creating an application which allow user to check any radio button they want and move to the next question, but once they go back, the selection will disappear, are there any way of storing which radio button did user click, and it will autoclick once the form is loaded? (like what I was trying to do in the code)

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    `Session, hidded field, adding javascript that will disable the back button...etc` are you also doing and `IsPostBack` checks..? – MethodMan Mar 05 '15 at 21:41
  • possible duplicate of [What is a NullReferenceException and how do I fix it?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – vesan Mar 05 '15 at 22:51

2 Answers2

0

the code you show is correct. Except it needs to be

Binary.frm_binaryQuesiton1.radioCheck.Checked = <saved value>;

And you need to store the saved value in a global somewhere

pm100
  • 48,078
  • 23
  • 82
  • 145
  • The code seems correct as you said. But as he gets an exception, see title of the post, the answer doesn't fit. @falldawn: provide more code, debug your code using breakpoints. – Tobias Knauss Mar 05 '15 at 21:44
  • i agree, he needs to show more code and exactly where he gets the error – pm100 Mar 05 '15 at 21:48
  • I have no idea what i was doing, sorry for any confusion, all i want to do is, when user check one question and move to next form, he can be able to come back to this question, and the answer will be left as it is. i.e. if user click radio button1, and move to next question and come back, radio button1 will still be check – Falldawn Mar 05 '15 at 22:31
0

this error occurs when your object contains null refernce .. your object doesnot pointing any thing ,,please elaborate your question or post your code to get appropriate answer !!