Rated
Read 14,223 times
Related Categories
Prevent phantom apps using the DataReport
VB 6.0's new DataReport designer provides a great way to display
simple datasets. When you use this new tool, however, you may have
found phantom instances of your application cropping up on machines
using the final compiled version. This behavior occurs if you print
the DataReport via code, but don't unload it when you're through with it.
For instance, suppose we added a button to a form with the following code:
Private Sub Command1_Click()
DataReport1.PrintReport
End Sub
and then compiled the project. When you launch the new application,
click the button, and close the application, a phantom instance of
the application shows up in the Windows Task Manager. This phantom
instance results because Visual Basic instantiates the DataReport
object but never unloads it when it's through printing.
To fix this glitch, simply unload the DataReport in the form's
Unload() event, like so
Private Sub Form_Unload(Cancel As Integer)
Unload DataReport1
End Sub
James first started writing tutorials on Visual Basic in 1999 whilst starting this website (then known as VB Web). Since then, the site has grown rapidly, and James has written numerous tutorials, articles and reviews on VB, PHP, ASP and C#. In October 2003, James formed the company Developer Fusion Ltd, which owns this website, and also offers various development services. In his spare time, he's a 3rd year undergraduate studying Computer Science in the UK. He's also a Visual Basic MVP.
Comments
|