Hi,
I am developing a piece of software using VB.NET which allows teachers to test and monitor their students progress. The problem I am facing is that I am using a Module to hold the questions array variable:
Friend Questions() As String
When I attempt to apply a value to each of the array variables, I get the followng error:
Object reference not set to an instance of an object.
I am using the following code to do this:
For k = 0 To 9
Questions(k)=questionDs.Tables("TestQuestions").Rows(k).Item("Question").ToString
Next
I do not understand why it wont apply the values given to it for each of the array variables. If I make Questions() into a standard String using Friend Questions As String , it will apply the value.
I understand that I could create 10 seperate Questions String variables and apply a value to each one but I am trying to cut down on my LOC. Can anyone tell me why I cannot set each array value or how to fix my code to enable this?
I am developing a piece of software using VB.NET which allows teachers to test and monitor their students progress. The problem I am facing is that I am using a Module to hold the questions array variable:
Friend Questions() As String
When I attempt to apply a value to each of the array variables, I get the followng error:
Object reference not set to an instance of an object.
I am using the following code to do this:
For k = 0 To 9
Questions(k)=questionDs.Tables("TestQuestions").Rows(k).Item("Question").ToString
Next
I do not understand why it wont apply the values given to it for each of the array variables. If I make Questions() into a standard String using Friend Questions As String , it will apply the value.
I understand that I could create 10 seperate Questions String variables and apply a value to each one but I am trying to cut down on my LOC. Can anyone tell me why I cannot set each array value or how to fix my code to enable this?