title: How do I check for an object being Nothing in VB6?
body: <p>In my VB6 application I have an array of objects declared thus...</p>
  
  <pre><code>Dim MyArray() as MyClass
  </code></pre>
  
  <p>This array is filled in as processing goes on</p>
  
  <pre><code>Set MyArray(element) = passed_object
  </code></pre>
  
  <p>and as elements are no longer wanted,</p>
  
  <pre><code>Set MyArray(otherelement) = Nothing
  </code></pre>
  
  <p>When using the array, I want to use a loop like</p>
  
  <pre><code>For i = 1 To Ubound(MyArray)
      If MyArray(i) &lt;&gt; Nothing Then    ' Doesn't compile
          ...do something...
      End If
  Next i
  </code></pre>
  
  <p>But I can't get anything likely-looking to compile. I've also tried</p>
  
  <pre><code>If MyArray(i) Is Not Nothing Then
  </code></pre>
  
  <p>Should I want to do this, and if so, what test should I put in here?</p>