WARNING #6002

    UserControl Event 1% is not supported.

    Description

    Using the VBUC, ActiveX controls can be migrated to .NETWindows Controls. This can present a problem when migrating certain ActiveX User Controls that implement Events that are no longer supported in .NET. In most cases, this is because they do not have an exact equivalent in .NET.

    Recommendations

    An understanding of both the source platform and the target platform is helpful in coming up with a viable solution. Some of this is described in MSDN's User Controls for Visual Basic 6.0 Users.

    Visual Basic 6.0 Support

    Resources for those unfamiliar with Visual Basic 6.0 ActiveX Controls:

    .Net Framework Support

    Source VB6

    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
        Debug.Print "WriteProperties"
        PropBag.WriteProperty "Caption", Caption, Extender.Name
    End Sub
    

    Target VB.NET

    'UPGRADE_ISSUE: (2068) PropertyBag object was not upgraded.
    'UPGRADE_WARNING: (6002) UserControl Event WriteProperties is not supported.
    Private Sub UserControl_WriteProperties(ByVal PropBag As UpgradeSolution1Support.UpgradeStubs.PropertyBag)
    	Debug.WriteLine("WriteProperties")
    	'UPGRADE_ISSUE: (2064) UserControl property UserControl1.Extender was not upgraded.
    	'UPGRADE_ISSUE: (2064) PropertyBag method PropBag.WriteProperty was not upgraded.
    	PropBag.WriteProperty("Caption", Text, Me.getExtender().Name)
    End Sub
    

    Target C#

    //UPGRADE_ISSUE: (2068) PropertyBag object was not upgraded.
    //UPGRADE_WARNING: (6002) UserControl Event WriteProperties is not supported.
    private void UserControl_WriteProperties(UpgradeStubs.PropertyBag PropBag)
    {
    	Debug.WriteLine("WriteProperties");
    	//UPGRADE_ISSUE: (2064) UserControl property UserControl1.Extender was not upgraded.
    	//UPGRADE_ISSUE: (2064) PropertyBag method PropBag.WriteProperty was not upgraded.
    	PropBag.WriteProperty("Caption", Convert.ToString(Caption), this.getExtender().Name);
    }
    

     

    This solution makes use of Application Settings to replace Visual Basic 6's PropertyBag. 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 assumes that these values need to be preserved between instances of the program.

    private void UserControl_WriteProperties()
    {
    	Debug.WriteLine("WriteProperties");
    	Properties.Settings.Default.Caption = this.Name;
    }
    

    Download VBUC Free Trial
    Download VBUC Now

    It's time to eradicate VB6
    ROI of eradicating VB6

    8 Proven Tips for
    Planning a Successful Migration

    8 Tips for migration