There are few customers who are using VSFlexgrid 7.0 in their old legacy VB 6.0 applications, and want to migrate to the corresponding .NET version i.e. C1FlexGridClassic.
Why conversion to C1FlexGridClassic?
As C1FlexGridClassic derives from C1FlexGrid and provides an object model that is virtually 100% identical to the VSFlexGrid ActiveX control, allowing easy migration to .NET. Thereafter one can move to powerful, full-featured grid control, C1FlexGrid for .Net. This blog explains to the conversion of VSFLex 7.0 to C1FlexGridClassic. It can be achieved in two main steps: v7 to v8 and then v8 to .Net.
Conversion from v7 to v8
The first step is to convert from v7 to v8 of the VSFlexGrid. There is a Convert utility which is designed for conversion of applications based on VB6, so unfortunately it will not do anything for .NET applications. There were not many changes between VSFlexGrid 7 and VSFlexGrid 8, so a manual upgrade also is fairly easy. Following are the steps for the conversion:
- Take back up of your project.
- If practical, delete the old design time instances of the VSFlexGrid. If there are too many design time properties set, or have too many instances of the grid, then it may be easier to change the version in the designer code.
- Remove the old VSFlexGrid references from the project, including the ActiveX wrappers generated by .NET.
- Add an instance of each type of VSFlexGrid 8 control that is there in the project (light, oledb or any other combination of VSFlexGrid flavours). If you decide to keep the old design time instances or if you have created all instances in code then do not delete everything. In short, each instance needs to be replaced in case all instances of the VSFlexGrid were removed.
- You may also need to rename the grids to the old names for existing grid code to work, unless they just kept the default grid names.
- Look through the code for any specific mentions of v7, for example AxVSFlex7L.AxVSFlexGrid, and change them to v8. This should be just a matter of changing 7s to 8s. Note that class names are going to begin with Ax, since the .NET wrappers add that on.
- Rebuild your application.
If the application rebuilds successfully then the conversion from v7 to v8 is complete.
Conversion from v8 to .Net
Now for conversion of application to .Net do the following:
- Remove the current references of the ActiveX flexgrid.
- Replace the same by adding the C1FlexGridClassic into your project.
- You would need to replace the Name and some other specific properties of C1FlexGridClassic so that it can work with the same code as VSFlexGrid 8.0 was working.
- Rebuild your application.
This would transfer all your output to the new C1FlexGridClassic; however any design time properties would be lost so you have to make sure to take care of them by replacing the same in the Designer.vb or Designer.cs file. Usually the ActiveX runtime license appears to be added to the resources of the form to which it is added. Specifically, it is embedded somewhere in the Form.resx file, and is marked as OcxState for the control. This contains properties and apparently the license. (In case of VB 6.0 or VS.NET). In case you face some license problems then you may just delete the OcxState property in the Form.resx file and then load the project, recompile it and it would recreate the Form.resx-file. This would clarify a majority of things that you would need to migrate, and your project would be using the C1FlexGridClassic as of now in .NET environment. Hence the application is converted to .Net.