Visual Basic Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘event’

PRB: Cannot Use Data Transformation Services Event Handlers in Visual Basic with Execute Package Task

Symptoms
If you install Data Transformation Services (DTS) Package event handlers in a Visual Basic application, and the package you call uses an Execute Package task to call another package, an Exception Access Violation (AV) similar to the following may occur:

(1:Child Package) SubStep ‘<title of step> Step’ failed with the following error:
Need to run the object to perform this operation
(Microsoft Data Transformation Services (DTS) Package (80040005):
Provider generated code execution exception:EXCEPTION_ACCESS_VIOLATION)The Access Violation occurs when these conditions are true:You use DTS package event handlers in the Visual Basic application.You use a parent DTS package that uses an Execute Package task to call a child DTS package.
Resolution
Threading limitations in the design of Visual Basic 6.0 prevent the nested child package from reporting it’s events up through the parent package’s event handler.

PRB: “Requested Registry Access Is Not Allowed” Error Message When ASP.NET Application Tries to Write New EventSource in the EventLog

Symptoms
When you use ASP.NET to create a new event source in the event log, you may receive the following error message:

System.Security.SecurityException: Requested registry access is not allowed.
Resolution
By default, the user token of the ASP.NET worker process is ASPNET (or NetworkService for applications that run on Internet Information Services [IIS] 6.0). The problem in the “Symptoms” section occurs because your account does not have the correct user rights to create an event source.

FIX: Error When Closing a Program Through the Control Box

Symptoms
An application error occurs when you close a Visual Basic program throughthe control box if the Visual Basic program executes a command after anobject created from a class module is set to nothing. This problem occursonly in the 32-bit edition of Visual Basic 4.0.
Resolution
The workaround to this issue is execute all the code in the event beforesetting the object to nothing. The statement to set the object to nothingshould be the last line in the event procedure.

BUG: IDE Crash with Compiled GlobalMultiUse

Symptoms
If the Terminate event of a GlobalMultiUse class calls a procedure inanother DLL, and if the same GlobalMultiUse class had previously called thesame DLL, then you receive an error and the IDE may crash.
With Visual Basic 5.0, you may receive one of the following errors:

Exception: privileged instruction (0xc0000096), Address: 0×00186a3a
-or-

VB5 caused an invalid page fault (or general page fault)
With Visual Basic 6.0, the IDE does not crash, but you may receive thefollowing error:

Run-time error ‘-2147418105 (80010007)’:
Automation error
This error translates to:

“The callee (server [not server application]) is not available and
disappeared; all connections are invalid. The call may have executed.”
Resolution
This problem can occur when the ActiveX components are not shut down in thenecessary order when your client application ends. For example, supposeyour client application uses two ActiveX DLLs (DLL1 and DLL2). If theTerminate event of a class in DLL2 calls a procedure in DLL1, but DLL1 hasbeen shut down before DLL2, you can experience this problem because theprocedure in DLL1 is unavailable. The “Steps to Reproduce Behavior” sectionof this article demonstrates this scenario and shows how to work around theproblem by controlling the order in which the two DLLs shut down.

BUG: Form Unload in Any DBGrid Event Ends Visual Basic

Symptoms
Unloading a form with a DBGrid control by using the Unload statement in theany event of the DBGrid control causes an application error that ends theVisual Basic program.The following are ways to work around this issue:
Set the form to nothing prior to unloading the form.
-or-Unload the form in an event other than a DBGrid event.
Resolution
Microsoft has confirmed this to be an issue in the Microsoft productslisted at the beginning of this article. Microsoft is researching thisproblem and will post new information here in the Microsoft Knowledge Baseas it becomes available.

BUG: DTS Package Execution Is Canceled Unexpectedly in a Visual Basic Application

Symptoms
When you execute a multiple-step Data Transformation Services (DTS) package from a Visual Basic application in which the DTS event handlers are installed, the package execution may be canceled unexpectedly and you may receive the following error message:

Runtime error ‘-2147220441 (80040427)’: Execution was canceled by user.
Resolution
This problem occurs because the pbCancel Boolean flag in the OnQueryCancel event, without user intervention, is sometimes set to True unexpectedly, which causes package execution to be canceled prematurely.