Break VB6 project into chunks to use free version of Artinsoft

风格不统一 提交于 2019-12-02 23:19:13

问题


I am trying to convert a large (200K lines) VB6 project into C#. I only want to convert the form design because I want to rewrite all the actual code in C#.

I want to use the free Artinsoft converter but this only allows projects of 10K lines. I am thinking I could break the VB6 project into 20 separate projects and then generate the C#.NET forms by using Artinsoft, then bringing the converted forms back into one C# project.

Is this feasible?

EDIT: Will this work? What are the potential problems?


回答1:


I will try it in following order

1) Write automated test cases at least for major business operations

this will save you a lot of bother verifying the results later on.

2) Refactor your VB (try to move out your business logic in separate Classes/DLLs).

3) you can verify your re-factoring using automated test cases written in step 1.

4) Now you have small chunks this will also help you create chunks then you can use Artinsoft.

5) Your new C# application will be nicely layered.

6) Run tests created in step 1 on your new application and on your old application and compare results and keep improving unless they match :)




回答2:


I would advise against using a converter for the UI. It may seem trivial, but there are features that simply do not natively exist in .NET (control arrays without a wrapper for a big one). And the control wrappers it creates are not fun to use nor maintain.

VB6 does not port well; the UI nor the code. If you were to continue down this path, there are things that can help.

  1. Remove all unused forms and code
  2. Ensure there are no control arrays and if there are, correct related code
  3. Get all logic wrapped in classes
  4. Ensure you are not calling/loading/referencing forms directly and that you are using an instantiated object
  5. Ensure good encapsulation practices are in use and good object oriented design patterns

I would seriously reconsider conversion. Converted code/UI sounds great, but in my bad experiences with VB6 conversion, there are so many problems because of how bad VB6 allowed developers to be and features that simply don't exist anymore.

Do yourself a huge favor... Start a new project, create a custom control library that inherits from the standard controls you use, and use those everywhere. Don't like the way Cliptext works on a masked textbox in C# versus VB6? Extend it or override it. Want all your listviews to be sortable? Easy, single-point implementation. Find out in a year that the business wants spell checking on 90% of textboxes? Easy.



来源:https://stackoverflow.com/questions/8200164/break-vb6-project-into-chunks-to-use-free-version-of-artinsoft

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!