Printers info not refreshing while debugging
<p>I'm having trouble debugging a specific printer paperbin problem. I seems that VB6 does not refresh/update the printer info while debugging. I have narrowed it down to a simple piece of code.</p>

<pre><code>Private Sub Form_Load()
    Dim prt As Printer

    For Each prt In Printers
        AddOutput prt.DeviceName
        AddOutput "Paperbin: " &amp; prt.PaperBin
    Next
End Sub
</code></pre>

<p>This code loops through all the printers and shows their names and paperbin values. The <code>AddOutput</code> procedure adds it to a Textbox. When I run this code from the VB6 IDE the paperbin value is the same for all printers. When I compile this code to an executable and run it then the output shows the correct paperbin values.
I found out that when I add a watch to the the <code>prt</code> object and collapse the information that the paperbin is correctly updated. From that moment on the VB6 IDE uses that specific paperbin value for all printers.</p>

<p>Why is the VB6 IDE giving the wrong value while the compiled version is giving the right value?</p>

<p>I have tested this code on Windows 7.</p>

<p><strong>Update</strong></p>

<p>Looping by index make no difference, so using <code>For i = 0 to Printers.Count -1</code> has the same problem as using <code>For each prt in Printers</code>.</p>

<p>Other properties are also affected. Properties like <code>PrintQuality</code>, <code>PaperSize</code> and <code>Duplex</code> do not update. Properties <code>DeviceName</code> and <code>Port</code> are updating correctly.</p>