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 ‘error message’

PRB: “Failure Writing to the System Registry” Error Message

Symptoms
When you run a setup program that was created using the Application SetupWizard, you receive the following error message:

Failure writing to the system registry. The registry may be corrupt, or
you may not have the required permissions to write to the registry.
Resolution
As the error message indicates, the problem may be due to a corruptregistry or incorrect permissions to write to the registry. In addition,the problem occurs on computers running Windows 95 when the Setup programtries to add an entry to a registry key and the key will exceed 64K in sizeas a result. Registry keys are limited to 64K in Windows 95.

PRB: “Argument Not Optional” Error Using DAO 3.5

Symptoms
After porting a Visual Basic 4.0 program that is written using DAO 3.0(Data Access Objects) to DAO 3.5, the error message:

“Argument Not Optional”will occur on the Update, Movelast, and CommitTrans methods. This does nothappen in Visual Basic 5.0.
Resolution
In DAO 3.0, the methods listed above do not use optional arguments. They douse optional arguments in DAO 3.5. This is a problem caused by adding theTyped Optional Parameter feature to OLE Automation. Only newer Automationcontrollers such as Visual Basic 5.0 are going to understand this. VisualBasic 4.0 can accept optional parameters only if they are of the Variantdata type. The optional arguments for the methods listed above are notVariant so it doesn’t recognize them as optional.

PRB This Action was Cancelled by an Associated Object.(3426)”

Symptoms
This article discusses the error message “This action was cancelled by anassociated object.” that Visual Basic generates when working with Accessdatabases and the Data control. This article does not apply to the ADO datacontrol.
Resolution
This error is being generated because the AddNew command of a boundrecordset causes Visual Basic to try to save the current record if the datahas changed. Because the data control is currently pointing to a NULLrecord and not an empty record, the data cannot be saved so the “action wascancelled by an associated object” error is reported. This is commonly seenwhen using the data form wizard in Visual Basic versions 4.0 and 5.0. Thedata form wizard in Visual Basic 6.0 generates code for the ADO datacontrol so this error is less likely to occur.

FIX: Jet Provider Errors When Setting a Field Equal to a Field Containing an Empty String

Symptoms
When you save a recordset text field containing an empty string to anotherrecordset’s field (this assumes both fields allow zero length), you get the following error message:

Errors occurred. ‘-2147217887 (80040e21)’.
Resolution
ADO thinks it is dealing with an object instead of a property.

Error message when you use DataReader in Visual Basic .NET: “Invalid attempt to read from column ordinal”

Symptoms
When you use DataReader to read a row, if you try to access columns in that row, you receive an error message similar to the following:

System.InvalidOperationException: Invalid attempt to read from column ordinal ‘0′.With CommandBehavior.SequentialAccess, you may only read from column ordinal ‘2′ or greater.
Resolution
This problem occurs because you executed OleDbCommand or SqlCommand with the System.Data.CommandBehavior.SequentialAccess flag set but did not access the columns sequentially.

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.