Quiz Error: XML /System.NullReferenceException


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


 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?



Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
check page view state is enabled
if no, enable the page level viewstate

<%@ Page EnableViewState="true" %>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tania_FarmerAuthor Commented:
That did it - thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.