In VB6 you can defined that a variable, property, or parameter be of type OLE_COLOR, as in this code:
Private m_ForeColor As OLE_COLOR
Public Property Get ForeColor() As OLE_COLOR
ForeColor = m_ForeColor
End Property
Public Property Let ForeColor(ByVal newValue As OLE_COLOR)
m_ForeColor = newValue
End Property
The OLE_COLOR type is actually nothing but a 32-bit integer, but it is a hint to VB6 that it represents a color. Consequently, VB Migration Partner converts the OLE_COLOR type into the System.Drawing.Color type.
This substitution works in all cases, except when you have an optional OLE_COLOR parameter:
Sub SetForeColor(Optional ByVal foreColor As OLE_COLOR = vbBlue)
foreColor = m_ForeColor
End Sub
The problem with this code is that you can’t assign a default value to a System.Drawing.Color structure. In fact, the code that VB Migration Partner generates doesn’t compile under VB.NET:
Sub SetForeColor(Optional ByVal foreColor As System.Drawing.Color = VBRUN.ColorConstants.vbBlue)
foreColor = m_ForeColor
End Sub
The current version of VB Migration Partner doesn’t allow you to fix this – admittedly rare – problem by means of pragmas. The only remedy is to edit the original VB6 code and change the OLE_COLOR parameter into a Long parameter:
Sub SetForeColor(Optional ByVal foreColor As Long = vbBlue)
foreColor = m_ForeColor
End Sub
The suggested change has absolutely no effect on the way the original VB6 code behaves.
Alternatively, you might decided to preprocess the VB6 code and transforms all OLE_COLOR parameters and variables – but not properties – into plain Long values. You can do it by means of a PreProcess pragma, as in:
Notice that you must store this text inside a *.pragmas file if you want to apply it at the project-level.