[Vb/. Net] converting VB6 to VB. NET [Part II] [one]

Source: Internet
Author: User
Part 1 Original article:

Last month (vol. 2, issue 9), I gave an executive overview of the conversion process, and started looking at converting General VB6 code to VB. net. this month I will finish General conversions, including DLLs, then start on Database conversions. next month, in the final segment, I will cover converting ASP. net web pages, and look at converting to VB. NET 2005 and C #.

 

Nothing is perfect

After the conversion wizard is done, the upgrade report will probably contain a list of parameter issues. A lot of these issues are minor things that nothing can be done about, but which in most cases will have little impact on the final program. for instance, if you use the zorder property in VB6, The Wizard will convert it, but add a message that the behavior has changed. all of the issues flagged by the Wizard will have a link to a URL explaining the problem. in the case of zorder, the difference between the VB6 behavior and the VB. net behavior is in that in VB6 the form is brought to the front of the application; in VB. net the application is also brought to the front of all other applications running on the computer. in most cases this is closer to the desired result than in the VB6 behavior.

 

The dir command is another example. in VB6, using the Dir command to list the files in a directory always listed ". "and ".. "First in the returned file list, the Dir command wowould always list them first. in VB. net ,". "and ".. "are never listed in the Dir results. these were not always listed in VB6-for instance, they are not part of the root "\" directory-so correct VB6 code checks for these directories. such code will perform correctly in VB. net. however, some VB6 programs just ignore the first two files returned by Dir, assuming they are ". "and ".. "; this code will always miss the first two files in VB. net, and in some cases in VB6. this is another example of well-written Code Converting well.

Translation:

Last month (Vol. 2, issue 9), I roughly described the conversion process, and began to pay attention to the general VB6 to VB. NETCode. In this month, I will perform more general conversions, including DLLs. Then I will focus on Database conversions and convert them to VB. net2005 and C #.


Nothing is perfect

After the conversion wizard is complete, the upgrade report will list as many problems as possible. Many of these problems are minor issues that cannot be solved by the Upgrade Wizard, but most of these problems will not end upProgramWhat is the impact. For example, you have used the zorder attribute in VB6, but added a message after the wizard converted the code, which means the behavior/function has changed. All issues marked by the Wizard will be indicated by a link to a URL. In the zorder problem mentioned above, VB6 and VB. net, the difference is that the forms in VB6 are displayed at the front end of the program. net will do the same, but it will also be shown in applications running on other computers. In most cases, this approach is closer to what I expect from programmers than VB6.

Another example is about the Dir command. In section 6 ". "and ".. ", while VB. net will not appear in the returned list. But it is not always listed in VB6-> for example, when they do not belong to the root directory. Therefore, the correct VB6 code will check these directories and such code will be correctly executed in VB. NET. However, some VB6 programs will assume that the returned results are ". "and ".. "(actually a real file), and then simply ignore the first two files returned by Dir, so that the transplanted code in VB. net will always lose the first two files. This will happen in some cases in VB6. This is alsoAnother example of well-written Code Converting well.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.