Fixing OLE_HANDLE values of Bitmap properties for commands, tools, and dockable windows


Summary
Using the Visual Basic Upgrade Wizard in Visual Studio to auto-translate Visual Basic 6 (VB6) code to Visual Basic .NET (VB.NET) is not 100 percent automated. This topic shows ArcGIS developers how to manually correct code where VB6 OLE_HANDLE values that do not work after the auto-translation.

About fixing OLE_HANDLE values

The following are example VB .NET errors:
  • Error 1 Class 'clsAlgColorRamp' must implement 'ReadOnly Property Bitmap() As Integer' for interface 'ESRI.ArcGIS.SystemUI.ICommand'. Implementing property must have matching 'ReadOnly' or 'WriteOnly' specifiers.
  • Error 2 Type 'ESRI.ArcGIS.esriSystem.OLE_HANDLE' is not defined.
The following is the cause of the VB .NET error:
  • The wrong return data type is not translated correctly by the upgrade wizard for properties and functions that return an esriSystem.OLE_Handle. In VB .NET, it is System.Int32. Change the return data type to the correct data type.
The following is the original VB6 code:
[VB6]
Private Property Get ICommand_Bitmap() As esriSystem.OLE_HANDLE
End Property
The following is the auto-translated code to VB .NET:
[VB.NET]
'Initial auto-translated VB .NET conversion.
Private ReadOnly Property ICommand_Bitmap() As ESRI.ArcGIS.esriSystem.OLE_HANDLE Implements ESRI.ArcGIS.SystemUI.ICommand.Bitmap
Get
End Get
End Property
[VB.NET]
'Correct VB .NET translation.
Private ReadOnly Property ICommand_Bitmap() As System.Int32 Implements ESRI.ArcGIS.SystemUI.ICommand.Bitmap
Get
End Get
End Property


See Also:

Migrating from VB6 to VB.NET
General steps for migrating from VB6 to VB.NET




Development licensing Deployment licensing
ArcGIS for Desktop Basic ArcGIS for Desktop Basic
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced
Engine Developer Kit Engine