title: VB.Net "COMException was unhandled" Error
body: <p>I have a VB.Net program written with .Net 2.0
  I'm trying to write a code that logs entire registry entries into a log file.
  I have got it to work wit the following code.
  <a href="http://pastebin.com/kmA63cUe" rel="nofollow noreferrer">http://pastebin.com/kmA63cUe</a>
  However whenever I try to add an additional Registry key to log</p>
  <pre><code>LogPrint4(&quot;&lt;-----------------HKLM/WebCheck--------------------&gt;&quot;)
      If reg.enumvalues(&amp;H8000002, &quot;Software\Microsoft\Windows\CurrentVersion\WebCheck&quot;, keys2, types) = 0 Then
          If IsArray(keys2) Then
              For p = 0 To UBound(keys2)
                  reg.getstringvalue(&amp;H8000002, &quot;Software\Microsoft\Windows\CurrentVersion\WebCheck&quot;, keys2(p), value)
                  LogPrint4(keys2(p) &amp; &quot;=&quot; &amp; value)
              Next
          End If
      End If
  </code></pre>
  <p>It comes up with the following error</p>
  <blockquote>
  <p>COMException was unhandled Check the ErrorCode Property of the
  exception to determine the HRESULT returned by the COM object.</p>
  </blockquote>
  <p>I'm not sure why it is limiting it only to 5 checks.
  Anyone have any ideas?</p>