Here is some simple code to validate that an array is valid. Before trying to use an array, you should always validate it with this code first.
Public Shared Function IsValidArray(ByVal array As Array) As Boolean
Dim valid As Boolean = False
If array Is Nothing Then
Throw New ArgumentNullException("array")
End If
If (array IsNot Nothing) AndAlso (array.Length > 0) Then
valid = True
Return valid
End Function
Tip By: David McCater
This code and more like it can be found in the dotNetTips.Utility assembly on the CodePlex site: http://www.codeplex.com/dotNetTipsUtility