- INDEX VB TO NET
- KNOWLEDGE BASE
- EWIS-ISSUES
- ISSUE #6003
ISSUE #6003
%1 %2 was not upgraded.
Description
This issue means that the property was not migrated. The most common instance of this EWI involves the PropertyBag object. This EWI seems to be closely related to EWI 2068-2069, though this version seems to apply to UserControls.
Recommendations
For this EWI, the best solution is to find an equivalent to the not-yet-migrated functions or properties. You can use the Custom Maps Feature to change in an automatic way the uses of the non migrated properties. You could use a Wrapper approach too. For the specific case of the PropertyBag, you can find more info in these links:
Sample VB6
PrivateSub UserControl_ReadProperties(ByVal PropBag As PropertyBag)
mListIndex = PropBag.ReadProperty("ListIndex", 0)
EndSub
Target VB.NET
'UPGRADE_WARNING: (6003) VBRUN.PropertyBag object was not upgraded.
'UPGRADE_WARNING: (6002) UserControl Event ReadProperties is not supported.
PrivateSub UserControl_ReadProperties(ByRef PropBag As UpgradeStubs.VBRUN_PropertyBag)
'UPGRADE_ISSUE: (2069) PropertyBag method PropBag.ReadProperty was not upgraded.
'UPGRADE_WARNING: (1068) PropBag.ReadProperty() of type Variant is being forced to Integer.
mListIndex = CInt(PropBag.ReadProperty("ListIndex", 0))
EndSub
Expected VB.NET
This solution makes use of Application Settings to replace Visual Basic 6's PropertyBag. However, in most cases this is not necessary as .Net's design model maintains the state of properties without the use of the Settings object. This example however assumes that maybe these values need to be preserved between instances of the program.
PrivateSub UserControl_ReadProperties()
mListIndex = My.Settings.ListIndex
EndSub
Target C#
//UPGRADE_WARNING: (6003) VBRUN.PropertyBag object was not upgraded.
//UPGRADE_WARNING: (6002) UserControl Event ReadProperties is not supported.
privatevoid UserControl_ReadProperties(UpgradeStubs.VBRUN_PropertyBag PropBag)
{
//UPGRADE_ISSUE: (2069) PropertyBag method PropBag.ReadProperty was not upgraded.
//UPGRADE_WARNING: (1068) PropBag.ReadProperty() of type Variant is being forced to int.
mListIndex = Convert.ToInt32(PropBag.ReadProperty("ListIndex", 0));
}
Expected C#
This solution makes use of Application Settings to replace Visual Basic 6's PropertyBag. However, in most cases this is not necessary as .Net's design model maintains the state of properties without the use of the Settings object. This example however assumes that maybe these values need to be preserved between instances of the program.
privatevoid UserControl_ReadProperties()
{
mListIndex = Properties.Settings.Default.ListIndex;
}