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 ‘visual basic 6’

BUG: “Public Overrides WriteOnly Property…” error when you try to override a Microsoft Visual Basic 6.0 property in Microsoft Visual Basic .NET

Symptoms
You have a Microsoft Visual Basic 6.0 class that has a property with the ByRef parameter. When you inherit the class in Visual Basic .NET and override the property, you receive the following compilation error:

‘Public Overrides WriteOnly Property myProp() As System.IntPtr’ cannot override ‘Public Overridable Overloads WriteOnly Property myProp() As System.IntPtr’ because they differ by their return types.
Resolution
The .NET runtime compares the return types of the parameters in the base class and inherited class property. This comparison returns a difference in the return types while it compares the symbols for System.IntPtr and System.Int16. Two separate symbols represent these internally. This results in an error.

PRB: Error When You Access an Array Field of a .NET Structure from COM

Symptoms
When you access an Array field of a structure that is defined in .NET from inside a COM DLL, you may receive the following error message:

“An unhandled exception of type ‘System.ArgumentException’ occurred in ProjectName”
Additional information: Wrong number of arguments or invalid property assignment.
Resolution
Because of the late-bound method that is used in this case, the Visual Basic 6.0 runtime cannot get the type information for the Array field that you are attempting to access.

PRB: Error Message “Missing or Not Registered VB6tmpl.tlb” When You Start Visual Basic 6.0

Symptoms
When you start Visual Basic 6.0 under a new user account or after a new install, and you try to run the Visual Basic 6.0 executable file (VB6.exe), you get the following error message:

Visual Basic was not able to start up due to invalid system configuration. Missing or not registered VB6tmpl.tlb.You are unable to continue and Visual Basic shuts down.
Resolution
The main Visual Basic type library is either missing or mis-registered for the current user. This message reflects the original working name of this file but in released versions of Visual Basic this file was renamed VB6.olb and is located in the same directory as the Visual Basic 6.0 executable (VB6.exe).
The registry should contain a path to this file under the following key:
HKEY_CLASSES_ROOT\TypeLib\{FCFB3D2E-A0FA-1068-A738-08002B3371B5}\6.0\9\win32If the key is missing or pointing to a location where the file cannot be found, Visual Basic returns the preceding error message during startup.

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: Error 800a2328 When You Browse a Visual Basic 6.0 WebClass (IIS Application)

Symptoms
When attempting to browse a WebClass application, the following error is returned:

Server object error ‘ASP 0177 : 800a2328′
Server.CreateObject Failed
/WebClassApp/WebClassFile.ASP, line 20
The operation completed successfully.

Resolution
This error occurs if Session state is disabled for the Web application.Visual Basic 6.0 WebClasses (IIS Applications) require Session state to be enabled.

FIX: “Unhandled exception” error message when you use Visual Basic 6.0 components from managed code

Symptoms
When you use Visual Basic 6.0 components in your managed code, you may receive “Unhandled Exception” error messages.
Resolution
Older versions of the Visual Basic 6.0 runtime (Msvbvm60.dll) have a shutdown problem that manifests as an “Unhandled Exception” error when you use Visual Basic 6.0 components from managed code.