I am setting an array's elements to Nothing if the same elements in another array is Nothing. (for various reasons I can't clone the array). Both arrays are Object type. However, when elements in the first array Objx(i, j) are equal to 0, the logical statement evaluates to Nothing and sets the second array's element to Nothing. Why is a zero element in an array of Object type evaluating to Nothing?
For i = 1 To NumRecords
For j = 1 To NumFields
If objx(i, j) = Nothing Then x(i, j) = Nothing
Next
Next
Also, there is a need use a missing data code, to test if an array's elements are missing, and therefore would be set to Nothing if missing is true.
Dim MissingDataCode As Object = Nothing
For i = 1 To NumRecords
For j = 1 To NumFields
If objx(i, j) Is MissingDataCode Then x(i, j) = Nothing
'If objx(i, j) = MissingDataCode Then x(i, j) = Nothing (does not work)
Next
Next
Now, if a user needs the missing data code to be set to -9999, and therefore sets:
MissingDataCode = -9999
will the following be able to catch values of -9999 and set the second array to Nothing?
If objx(i, j) = MissingDataCode Then x(i, j) = Nothing
or should the line of code be
If objx(i, j) Is MissingDataCode Then x(i, j) = Nothing