I have an Array that I will be resizing with the ReDim statement. For some
reason that I cannot figure out, I am recieving the following error:
[NullReferenceException: Object reference not set to an instance of an
object.]
The code that this occurs in is as follows:
Dim NavButton As NavButtonInfo
Dim TempButtons() As NavButtonInfo
For Each NavButton In ButtonList
If NavButton.parentname = tempparentname Then
ReDim Preserve TempButtons(TempButtons.GetUpperBound(0) + 1)
TempButtons(TempButtons.GetUpperBound(0)) = NavButton
End If
Next
The error occurs on the ReDim line of this code. I am assuming that this has
something to do with the fact that I initially declare TempButtons without
giving it's size, but if I do not have the array the exact size (which is
unknown until runtime) it will cause problems later in my code. For example,
if I place constants like 10 and 5 in the Redim and following lines, it will
get past this section of my code and then give me an error later in my code
when it tries to read from indexes that have not been assigned values. Any
help would be appreciated. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/