Previous | Index | Next 

[HOWTO] Migrate binary properties of nested user controls

In some cases, VB Migration Partner isn’t able to correctly migrate binary properties (e.g. the Picture property) of a UserControl nested in another UserControl. You can overcome this limitation in one of the following three ways.

First, write a control extender, as explained in this this article.

Second, extract the binary property from the .CTX file, by using this tool or by temporarily inserting a call to the SavePicture method in the Form_Load event handler. Next, you use the VBMP Project Dumper VB6 add-in to generate an XML file and modify the obtained file so that it points to the saved bitmap, as in this example:

    <projectitem name="formname">       
        <control name="controlname">         
             <property type="Object" name="Picture">           
                 <filename name="c:\savepict.bmp">           
                 </filename>         
             </property>       
        </control> 	  
    </projectitem>

(Notice that the items to be modified are inside the projectItem node that represents the form.)

Finally, you can save the modified XML file and migrate the UserControl.

Third, use the AxWrapperGen tool to create a wrapper for the UserControl and then convert the wrapper into pure .NET code that doesn’t depend on the any ActiveX control.

 

Previous | Index | Next