ISSUE #1046

    1% Parameter '2%' is not supported, and was removed.

    Description

    The VBUC contains a set of method and parameter mappings for VB6 and .Net. Included in this information are markers that indicate when parameters have been removed from their .Net counterparts. Whenever a paramter that has been removed is found in the original source code, this EWI is emitted by the VBUC.

    Recommendations

    There is no straightforward solution for this issue because some of the removed parameters may not have an equivalent in .NET at allIn some cases, the parameters change the behavior of the invoked method. The same effect might be possible by setting property values in the new .Net object. Likewise, an overload of the method might be available that provides this functionality. In other cases, there is no equivalent parameter to substitute, and it will be necessary to include code to replicate the desired functionality in .NET. Finally, in some cases the omitted parameters cause no discernable difference. They can be safely omitted in most cases without affecting the functional equivalence. Common cases of this EWI involve the use of the Size, ColorDepth, X and Y parameters of the LoadPicture function. It is also emitted in some uses of Interaction.AppActivate.

    Sample VB6

    PublicSub NotSupportedParams()
          MsgBox("Messge", vbOKOnly, "Title", "HelpFile", 10)
    EndSub

    PublicSub LoadFormPicture(ByVal picBox As PictureBox)
         picBox.picture = VB.LoadPicture("calc3.gif", 4, vbLPColor, 320, 86)
    EndSub

    Target VB.NET

    PublicSub LoadFormPicture(ByRef picBox As PictureBox)
    'UPGRADE_WARNING: (1046) LoadPicture Parameter 'Y' is not supported, and was removed.
    'UPGRADE_WARNING: (1046) LoadPicture Parameter 'X' is not supported, and was removed.
    'UPGRADE_WARNING: (1046) LoadPicture Parameter 'ColorDepth' is not supported, and was removed.
    'UPGRADE_WARNING: (1046) LoadPicture Parameter 'Size' is not supported, and was removed.
    picBox.Image = Image.FromFile("calc3.gif")
    EndSub

    Expected VB.NET

    Undetermined expected code, final solution will depend on resolution approach.

    Target C#

    staticpublicvoid LoadFormPicture( PictureBox picBox)
    {
           //UPGRADE_WARNING: (1046) LoadPicture Parameter 'Y' is not supported, and was removed.
           //UPGRADE_WARNING: (1046) LoadPicture Parameter 'X' is not supported, and was removed.
           //UPGRADE_WARNING: (1046) LoadPicture Parameter 'ColorDepth' is not supported, and was removed.
           //UPGRADE_WARNING: (1046) LoadPicture Parameter 'Size' is not supported, and was removed.
           picBox.Image = Image.FromFile("calc3.gif");
    }

    Expected C#

    Undetermined expected code, final solution will depend on resolution approach.


    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