Quiz Error: XML /System.NullReferenceException

Hi,

I am trying to use Enrico's asp.net online quiz script but keep getting an error.

 http://www.codeproject.com/KB/applications/xmlquiz.aspx

 The page loads in for the first time ok with the question showing but when i click the submit button I get this error:

 

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 42:
Line 43:       'Correct answer?
Line 44:       If rblAnswer.SelectedItem.Value = ViewState("CorrectAnswer") Then
Line 45:             intScore += 1
Line 46:             arrAnswerHistory.Add(0)


 What does this mean?  How do I fix it?

 

Thanks

Tania
Tania_FarmerAsked:
Who is Participating?
 
BinuthConnect With a Mentor Commented:
check page view state is enabled
if no, enable the page level viewstate

<%@ Page EnableViewState="true" %>
0
 
kaylanreilorCommented:
Which line is throwing the exception ?
Your problem be that arrAnswerHistory is null. If you set a break point there and run your page in debug you'll probably see that arrAnswerHistory=null and you try to use it anyway.
0
 
Tania_FarmerAuthor Commented:
That did it - thanks!
Tania
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.