Artinsoft Visual Basic Upgrade Companion Serial Port

11/24/2017by

Mobilize.Net's Visual Basic Upgrade Companion (VBUC) is the industry-leading tool for the migration of VIsual Basic 6 to both Visual Basic.NET and C#. With a proven track record of millions of lines of code upgraded to Microsoft's.NET Framework, the VBUC helps you move your business-critical. The others are usually fixed by just using dynamic (or VB.NET late binding). Which is an important thing to note. VBUC (Visual Basic Upgrade Companion) doesn't produce C# code using dynamics for you. So it's best to choose the option to NOT try to upgrade COM Interop code with helpers or you'll spend.

Artinsoft Visual Basic Upgrade Companion Serial PortArtinsoft Visual Basic Upgrade Companion Serial Port

ByRef / ByVal improved conversion The default behavior fo VB6 is that, unless explicitly qualified, parameters are passed by reference. As a result most parameters will end up as “ByRef” unless explicitly qualified as “ByVal”. When converting to C#, previous versions of the VBUC created temporary variables to pass in reference parameters when necessary, such as when a literal was being passed to a method. The VBUC 4.0 now thoroughly analyzes the source code to determine if a parameter can be safely converted from ByRef to ByVal. In typical code, this change reduces the amount of temporary variables generated because of this by approximately 70%. The generated code is now more readable and maintainable. Advanced Windows APIs conversion with refactoring With VBUC 4.0 all API declarations will be converted to a single declaration in just one place of the code.

Calls to these APIs will be redirected to this single declaration, and for each unsafe API declaration the VBUC creates a wrapper function that calls the API function. This refactoring functionality will also result in a more readable and maintainable code.

TypeName and TypeOf migration Additional support to the conversion of the VB6 function TypeName was added in version 4.0. The TypeName function is converted to the operator Is when it’s used in a conditional statement. The string that contains the name of the Type is changed to the corresponding type in.NET. Enhanced Default Property resolution The VBUC contains a helper class and an optional migration feature designed to resolve several late binding issues that are not solved by the typing mechanism.

However, in some cases this solution doesn’t work properly because the name of the property in.NET is different. Version 4.0 includes several improvements that increase the effectiveness of this feature. Automated COM Objects Memory Management In.NET this memory is released in a different time than VB6, and this could cause different behaviors. For example, in some cases ADO Connections will remain Open for more time than in VB6. This optional feature in VBUC 4.0 will generate explicit code to achieve the same behavior. Increased third-party component migration support • MSFlexGrid to.NET Extended DataGrid • TrueDBGrid to.NET Extended DataGrid • VBUC 4.0 has a new mapping mechanism called “alias” that allows applying existing mappings to other versions of the same control in an easy way. This new mapping method is used to add support for most of the TrueDBGrid and VSFlexGrid versions.

Improved assessment capability In assessment mode, VBUC 4.0 now generates automatic EWIs for non-supported members. Previous versions generated EWIs for members that didn’t have an equivalent in.NET only if there was a specific rule in the VBUC indicating that. This information is very useful to determine more precisely the manual effort required to migrate an application. Improved Usability. Localization and internationalization (Multilanguage) The UI and all messages, including EWIs, can now be displayed in German and Japanese, besides the standard English.

The user is able to select the appropriate language when the setup is executed. Enhanced installation VBUC 4.0 introduces a new streamlined license registration mechanism that allows the user to enter a new VBUC license file (VBUC.lic) with the help of a friendly wizard. This registration wizard is displayed when the VBUC does not detect a license or if the current one is invalid. The VBUC also provides feedback about the current status of the license while the user is working with the product. Also, VBUC 4.0 only requires administration rights to be installed, but this user role is not mandatory to execute and convert code. And Visual Studio.NET is no longer an installation requirement.

Finally, the VBUC and all its components were signed with a VeriSign secure certificate, so when the users execute the Setup the ArtinSoft name and the Certificate will appear. Support Microsoft latest Technologies.

Summary This page provides an overview of the Upgrading Visual Basic 6.0 to Visual Basic.NET and Visual Basic 2005 guide. This guide was developed jointly by the Microsoft patterns & practices team and, a company with vast experience in Visual Basic upgrades and the developer of the Visual Basic Upgrade Wizard and the Visual Basic Upgrade Wizard Companion. This guide provides valuable information for organizations who are considering upgrading their Visual Basic 6.0-based applications and components to Visual Basic.NET. It provides proven practices to reach functional equivalence with a minimal amount of effort and cost and guidance for common advancements after the application is running on the.NET framework.

In addition to the guidance itself, a new tool, the Visual Basic 6.0 Upgrade Assessment Tool, is provided to give your organization assistance in identifying common upgrade issues and estimating the cost and effort required to upgrade your Visual Basic 6.0 code. Downloads • • • • Community • License • Contents Overview Many companies have invested time and money in the development of applications built on the Visual Basic 6.0 language and related technologies. Despite the release of Visual Basic.NET, there has been hesitation in adapting these applications for the new version of the language. Although information about performing such upgrades can be found throughout the Web, comprehensive guidance that covers all aspects of upgrading has been lacking. The purpose of this guide is to provide this comprehensive guidance. The guide discusses everything from the initial assessment and planning stages, to practical development solutions for the issues that arise during an upgrade, to the testing of upgraded applications. The best practices for achieving functional equivalence with the minimal amount of cost and effort are also discussed.

Based on ArtinSoft's extensive experience with Visual Basic 6.0 upgrade projects, the practices, processes, and procedures provided in the guidance have been proven effective. There are also suggestions for advancing upgraded applications with new technologies available in Visual Basic.NET after functional equivalence is reached.

In addition to the guidance itself, a newly developed tool, the Visual Basic 6.0 Upgrade Assessment Tool, is provided to generate reports that an upgrade team can use to estimate the cost and effort of performing an upgrade on a particular application, component, or project. The tool analyzes Visual Basic 6.0 source code to identify issues that require manual attention to properly address. For each issue, the tool provides an estimate for the amount of time and the developer skill required to address it. These estimates and suggestions are based on ArtinSoft's extensive experience in upgrading Visual Basic 6.0 components and applications to Visual Basic.NET. After the tool analyzes your code, it produces reports in the form of Microsoft Excel worksheets that detail the analysis of the code. The information provided includes source code metrics (such as the number of forms, modules, and lines of code per file), the number and categories of upgrade issues that need to be addressed, and a recommended upgrade order.

There are also estimates for the amount of effort and cost to perform the upgrade (broken down by task and totaled) and suggestions for the developer resources needed to perform the upgrade. These estimates are configurable so that you can adjust the estimates to reflect the resources and level of experience available in your company. Detailed information about using the assessment tool and interpreting and modifying the reports is provided in the guide. Benefits The guide is based on extensive experience in performing upgrade projects on a wide range of Visual Basic 6.0-based applications. The knowledge gained during these upgrades has helped to produce the best practices that can be applied by anyone performing such an upgrade, and these practices have been captured in the form of this guide.

The benefit for the reader is that the provided practices, processes, and procedures have been thoroughly tested over many different projects over many domains and have shown to be effective. An added benefit is the assessment tool that was produced in conjunction with this guide. The assessment tool can analyze existing Visual Basic 6.0 code to assess the amount of manual effort that must be applied to upgrade an application to Visual Basic.NET.

It identifies upgrade issues in code and assesses the severity of each issue based on effort required to address it. The benefit is that much of the work in determining the feasibility and cost and effort estimates for an upgrade project can be automated. Audience Requirements This guidance is intended for technical decision makers, solution architects, and software developers. To perform upgrades using this guidance, you should have an understanding of the following technologies: • Microsoft Visual Basic 6.0 • Microsoft Visual Basic.NET • Microsoft.NET Framework 1.1 and.NET Framework 2.0 Concepts and Features of the Guide The guidance covers several aspects of the upgrade process, including: • General upgrade strategies. • Initial assessment. • Planning and preparation.

• Automatic upgrade procedures. • Upgrade issues. • Manual upgrade processes. • Application advancement. • Testing upgraded applications and components.

The guide discusses each of these aspects and includes practical examples that reinforce and demonstrate each discussion. The guide begins with a general overview of upgrading. This includes discussions of why you might want to consider an upgrade project and alternatives to upgrading, and a discussion of the information you need to gather to make the best informed decisions. The guide next follows with information about the upgrade process itself. Several tools for assisting with upgrades are discussed, including the Visual Basic 6.0 Upgrade Assessment Tool and the Visual Basic Upgrade Wizard. It details the processes for preparing applications before applying the tools to achieve maximum benefits.

Furthermore, the features of the Visual Basic 6.0 language that are supported and the limitations of the upgrade wizard are provided so that you can understand the 'why' behind each process or suggestion. The guide moves on to the continuation of the upgrade process after the automated upgrade tool finishes its work. Because there are limitations to what the tool can automatically upgrade, manual upgrade effort will have to be performed to complete the upgrade. The guide shows the types of issues that require manual attention, providing both details of each issue's source and the solution. Each solution includes code examples to provide practical demonstration. The issues discussed cover the complete range of possible Visual Basic 6.0 application types, from classic Windows Forms-based applications to Web-based applications, and more general language features such as data types, file input/output, database access, and distributed computing technologies. For applications in which complete upgrade is impractical because of time or budget constraints, the guidance provides information for achieving interoperability between Visual Basic 6.0 and Visual Basic.NET.

This allows you to upgrade portions of a project or application while leaving others in Visual Basic 6.0. Through these interoperability techniques, those parts of your application that are too costly to upgrade can be left in Visual Basic 6.0 indefinitely, leaving you free to upgrade them if and when the resources to upgrade them become available. After you upgrade an application to Visual Basic.NET, you can begin to take advantage of features and technologies previously unavailable in earlier versions of the language. The guide provides suggestions for the types of advancements you can make to your applications and offers advice about how to achieve them. For those advancements that are too extensive to cover in a few paragraphs, pointers to additional information are provided. Nexus Manual Pdf on this page.

Testing is a vital aspect of the upgrade process to ensure the reliability and correctness of your upgraded application. The guide provides information about how to best perform testing for upgraded applications. It describes potential upgrade strategies you can use and identifies the characteristics of applications and upgrade strategies that best fit each testing strategy. The testing processes and procedures for each strategy are detailed, as are the processes that are common to all testing strategies. It also lists some tools that can be used to facilitate testing. Concepts and Features of the Visual Basic 6.0 Upgrade Assessment Tool One of the key tasks of any upgrade project is to perform an assessment of the application to be upgraded to estimate the required cost and effort.

This can be an extremely time-consuming task, particularly for very large projects that span many forms and modules. This can be further complicated by a lack of experience in having performed an upgrade to Visual Basic.NET; it's hard to estimate the effort that will be required if you do not have experience with what the issues are. To alleviate some of the effort of assessment, the Visual Basic 6.0 Upgrade Assessment Tool has been developed. The purpose of this tool is to analyze your Visual Basic 6.0 projects to determine what issues you will need to address to be able to upgrade. It also provides information about where to get help understanding each issue and the types of skills needed to address them. The reports generated, in the form of Microsoft Excel worksheets, are configurable, so you can specify estimated costs for the different categories of issues. This helps to simplify the process of assessment by automating much of the work.

System Requirements To apply the provided guidance and to use the assessment tool, you will need the following: • Microsoft Windows 2000, Windows XP Professional, or Windows Server 2003 operating system • Microsoft Visual Basic 6.0 • Microsoft.NET Framework 1.1 (required) • Microsoft Visual Studio.NET development system (highly recommended, but not required) • Microsoft Excel 2003 (required to use the Visual Basic 6.0 Upgrade Assessment Tool) Getting Started It is recommended that you start by reading Chapter 1, 'Introduction,' starting with the section named 'Why Consider an Upgrade Project?' This section helps you determine if an upgrade is the right choice for your project and provides a list of alternative approaches to software evolution.

After determining that an upgrade is the right choice, you should continue by reading the section named 'Functional Equivalence and Application Advancement' in Chapter 2, 'Practices for Successful Upgrades,' to get a very clear understanding of the scope of the guide. Community This guidance offering, like many patterns & practices deliverables, is associated with a. On this community site, you can post questions, provide feedback, or connect with other users for sharing ideas. Community members can also help Microsoft plan and test future guidance offerings, and download additional content such as extensions and training material. Future Plans This guide and tool cover upgrades of Visual Basic 6.0 applications to Visual Basic.NET 2003 and Visual Basic 2005. At the time of this writing, there are no plans to create any new versions of this guide. Feedback and Support Questions?

To provide feedback about this guide, or to get help with any problems, please visit the. The message board on the community site is the preferred feedback and support channel because it allows you to share your ideas, questions, and solutions with the entire community. Alternatively, you can send e-mail directly to the Microsoft patterns & practices team at devfdbck@microsoft. Cakewalk Dimension Pro 1.5 Keygen there. com, although we are unable to respond to every message.

Upgrading Visual Basic 6.0 Applications to Visual Basic.NET and Visual Basic 2005 is a guidance offering, designed to be reused, customized, and extended. It is not a Microsoft product. For more information, see the following table. Add-in model changed in VB.NET. This is a VB add-in project.

The add-in programming model has changed in VB.NET, requiring major migration work. Feature not upgradable. ADO required for data binding in VB.NET. Data controls can be bound only to ADO, not to RDO or DAO.

Upgrade the RDO and DAO data binding to ADO before upgrading your project to VB.NET. See vb6 help or MSDN for topic 'RDO to ADO' or 'DAO to ADO'. Fix required before upgrade. Array must start at 0 in VB.NET. VB.NET requires arrays be declared with a lower bound of zero. Non-zero-based arrays will be upgraded to be zero-based.

A replacement format is available, allowing non-zero lower bounds, but it is slower than native arrays, and limited when passing arrays as parameter to functions. Use of zero-based arrays is recommended.

Arrays with negative bounds are especially problematic, as all.NET arrays are in the range 0.ubound. Arrays with a negative upper bound are not upgraded at all. Can be fixed before or after upgrade. As Any not allowed in VB.NET.

As Any will not be allowed in API declarations. Get prepared by adding a separate API declaration for all parameter types you may need. Can be fixed before or after upgrade.

As New doesn't auto-instantiate if object released in VB.NET. VB.NET does not automatically re-instatiate an object that has been explicitly released. This problem affects you only if you set this variable to Nothing and try to use it later without instantiating a new object first. Can be fixed before or after upgrade. As New unsupported for arrays in VB.NET. Arrays cannot be declared with 'As New'. You will need to remove the New keyword and initialize the array before use.

Can be fixed before or after upgrade. ByRef property params unsupported by VB.NET.

VB.NET does not support ByRef property parameters, because they can lead to unexpected behavior. All declarations of parameterized properties must specify ByVal for the parameters. The.NET upgrade wizard turns all ByRef parameters into ByVal without warning. Fix recommended before upgrade. ByVal/ByRef not allowed in API calls in VB.NET. ByVal or ByRef will not be available for calling the API.

Review your API declaration to find out if you can replace it by a better declaration where ByVal/ByRef is not needed to call. Can be fixed before or after upgrade. Circle and Oval unsupported by VB.NET.

VB.NET does not support oval and circle shapes. After migration, you will have to override the OnPaint event to draw the oval/circle. It won't pay off to do it before migration, because the drawing statements change too.

Work required after upgrade. Class Instancing changes in VB.NET.

There is no direct equivalent for the following Instancing property values: 3=SingleUse, 4=GlobalSingleUse, 6=GlobalMultiUse. The upgrade wizard sets the access level to Public. You can control the way that an object can be created by setting the access level of the constructor (Sub New).

The unavailability of the Instancing value may require changes in the way the class is being used. Work required after upgrade.

COM method not callable from VB.NET. VB.NET projects can call COM class methods but not COM module methods.

You may be able use the.NET framework classes to achieve the same functionality or you may need to keep your code in VB6. This problem detection rule requires that the corresponding COM file has been analyzed. Work required after upgrade. COM+/MTS not upgradable to VB.NET. The project refers COMSVCS.DLL (COM+ Services Type Library).

Existing code will need to be upgraded to use.NET transaction processing. Work required after upgrade. Conditional block will not upgrade to VB.NET. The VB.NET upgrade wizard doesn't migrate code inside a False branch of an #If.#ElseIf.#Else.#End If structure. It copies the code 'as is'. If the False branch is large, it is recommended that you temporarily set the condition it to True before migration.

Otherwise you will have to migrate it manually. Fix recommended before upgrade.

Control unsupported by VB.NET. A control type is not available in VB.NET. Image is auto-replaced by PictureBox. OLE Containers can be manually replaced by a browser control. MSComCtl2.UpDown won't upgrade but can be manually replaced by DomainUpDown or NumericUpDown controls.

Work required after upgrade. DDE unsupported by VB.NET. DDE is not available in VB.NET. You will have to use other kind of inter-process communication. Work required after upgrade. Diagonal line unsupported by VB.NET. VB.NET does not support diagonal Line controls.

After migration, you will have to override the OnPaint event to draw the line. It won't pay off to do it before migration, because the drawing statements change too. Work required after upgrade. DoEvents() returns no value in VB.NET. DoEvents() does not return the number of open forms, or any other value.

There will be no replacement function. The DoEvents statement will remain. Can be fixed before or after upgrade. Drag-and-drop requires rewrite for VB.NET. VB.NET supports drag-and-drop functionality, but the object model is quite different. Drag-and-drop code must be rewritten.

Work required after upgrade. Event behavior changes in VB.NET. The behavior of this event will change somewhat in VB.NET. You will have to review and test the event code after migration.

Affected events: ComboBox_Change, ComboBox_Scroll, ListBox_Scroll, Form_Activate, Form_DeActivate, Form_Terminate, Form_Unload, Class_Terminate. This problem is not reported for empty event handlers. Work required after upgrade. Event log model differs in VB.NET.

The event log model is different in VB.NET and manual work is needed. Affected code: LogMode, LogPath, StartLogging, StartMode. Work required after upgrade.

Initialized arrays in UDTs unsupported by VB.NET. Fields in user-defined types cannot be initialized arrays in VB.NET. Only arrays declared without dimension - MyArray() - are allowed. You must add code to ReDim array fields before use. Can be fixed before or after upgrade. MDIForm event unsupported in VB.NET.

The following events are unavailable: MDIForm_Click, MDIForm_MouseDown, MDIForm_MouseMove, MDIForm_MouseUp. There is no replacement.

This problem is not reported for empty event handlers. Work required after upgrade. Member cannot be default in VB.NET.

Variables, Subs and Functions are not allowed as default members of objects in VB.NET. VB.NET upgrade wizard adds the member name automatically if you have typed your object variables and thus used early binding. If you use late binding (As Object, As Variant), you will have to add the name manually. You may prepare for migration by marking this member as non-default and fixing all references by hand. Fix recommended before upgrade. Module not upgradable to VB.NET.

This module type is not available in VB.NET. DHTML pages: stay in VB6. DataReports: unable to migrate.

If your application depends heavily on property pages, it should be left in Visual Basic 6.0. ActiveX documents should either be rewritten as UserControls or left in VB6. Feature not upgradable.

No control arrays in VB.NET. Control arrays are lost in VB.NET.

Fortunately, there are replacements for this. Prepare to rewrite your code for this control after migration. You may also want to change the indexed controls to non-indexed before upgrading if this can be done without too much work. Can be fixed before or after upgrade. Old VB project not upgradable to VB.NET. This project was made in VB version 3 or 4. VB.NET will not load it.

You will need to upgrade to VB6 first. Feature not upgradable. OLE Automation unavailable in VB.NET. The OLE Automation features are unavailable in VB.NET.

You will need to use another kind of inter-process communication. Affected code: OleRequestPendingMsgText, OleRequestPendingMsgTitle, OleRequestPendingTimeout, OleServerBusyMsgText, OleServerBusyMsgTitle, OleServerBusyRaiseError, OleServerBusyTimeout. Work required after upgrade. ParamArray is ByVal in VB.NET. ParamArrays are ByRef in classic VB, but they will be converted to ByVal for VB.NET.

Your code seems to use ParamArray as an 'out' parameter to return values to callers. This is not possible in VB.NET. You should return 'out' values in the function return value (recommended) or in a regular ByRef array parameter (worse alternative). This problem rule does not fire for ParamArrays that do not return an 'out' value. Fix recommended before upgrade. Parameterless default properties unsupported in VB.NET. A property with no parameters can't be the default member of an object in VB.NET.

This means that you can no longer omit the property name to access the property. VB.NET upgrade wizard adds the property name automatically if you have typed your object variables and thus used early binding. If you use late binding (As Object, As Variant), you will have to add the name manually. You may prepare for migration by marking this property as non-default and fixing all references by hand.

Fix recommended before upgrade. Property mixes scopes. Property accessors have different levels of accessibility. This causes a problem when upgrading to VB.NET, because the upgrade wizard will convert all accessors to the widest scope, exposing previously hidden code. VB.NET 2002 and 2003 require property accessors to have the same scope.

VB 2005 supports different scopes for Get and Set, but the VB 2005 upgrade wizard does not: it still upgrades to the widest scope. Can be fixed before or after upgrade. Property passed ByRef. A property is being passed to a ByRef parameter in a procedure call. In VB6, the changes to the parameter are not updated to the property. Thus, only Property Get executes. In VB.NET, updates are copied to the property when the call exits (copy in/copy out semantics).

Thus, both Property Get and Set execute. This may lead to an unexpected change in the property value and a bug that is hard to detect.

You should enclose the property in parentheses, which enforces pass ByVal instead of ByRef. Alternatively you can change the formal parameter to ByVal (if that preserves the logic during other calls to the same procedure). Fix recommended before upgrade. Resource file requires work in VB.NET. The.NET resource file format is.resX. Code that loads resources (LoadResString, LoadResData, LoadResPicture) is converted automatically by the upgrade wizard, but the resource file itself is not.

Work required after upgrade. ScaleMode must be vbTwips for VB.NET. To make sure your forms upgrade correctly, always use ScaleMode=vbTwips.

VB.NET transforms your forms coordinates from twips to pixels. If ScaleMode is non-twips, you'll have sizing issues. Fix recommended before upgrade. Setting.Interval does not enable/disable timer in VB.NET. Setting Timer.Interval=0 does not disable the Timer (in fact, the interval will become 1 msec). You will have to use Timer.Enabled=False.

Setting Timer.Interval>0 does not enable it either, you will need to call Timer.Enabled=True. Work required after upgrade. String byte functions unavailable in VB.NET. The byte versions of string handling functions are not available in VB.NET. Encoding and decoding functions in the System.Text namespace replace this functionality. The upgrade wizard does not automatically convert the byte functions.

You may want to consider replacing them with the Unicode (wide) functions before upgrading. Affected functions: AscB, LenB, InStrB, ChrB, LeftB, MidB, RightB, InputB Can be fixed before or after upgrade. Sub Main not executed in VB.NET. The startup object is Sub Main. In VB.NET, Sub Main is not executed at all in this kind of a project. Work required after upgrade. Sub Main: VB.NET program exits at End Sub.

The startup object is Sub Main. Currently, the program exits when all objects are destroyed. In VB.NET, the program exits at end of Sub Main. Fix: Set a form to be the startup object.

Call Sub Main from Form_Load event. Work required after upgrade. TTF/OTF fonts required by VB.NET. If your application uses other fonts than TTF or OTF, these fonts will be changed to the system's default font, and all formatting (size, bold, italic, underline) will be lost.

This applies to the default VB6 font MS Sans Serif. You might want to change all fonts before migration. Fix recommended before upgrade. Type unsupported by VB.NET. Fixed-length string and Currency are not available as data types in VB.NET.

VB.NET will auto-convert Currency to Decimal, which has more precision. VB.NET has a replacement for fixed-length strings, but it is slow and limited. Arrays of fixed length string are not allowed at all. It is recommended to change all fixed-length strings to variable-length strings. Can be fixed before or after upgrade. Unavailable in VB.NET. The function or constant, or a direct replacement, is not available in VB.NET.

Affected code: CVErr, GoSub, Return, vbDataObject, vbUnicode, vbFromUnicode, vbDefaultButton4, vbAlias, vbDatabaseCompare, VarPtr, StrPtr, ObjPtr, VarPtrArray, VarPtrStringArray. In addition, LSet will have a replacement for strings, but not for UDTs. IsEmpty will be upgraded to IsNothing, which can cause a subtle bug because IsEmpty(vbNullString)=False will be upgraded to IsNothing(Nothing)=True. Can be fixed before or after upgrade. Underscore _names not hidden in VB.NET.

Underscore as the leftmost character does not mean 'hidden'. There is a new syntax for marking items as hidden in VB.NET IDE.

Work required after upgrade. VB5 project may not upgrade to VB.NET. This project was made in VB5.

You may be able to load it in VB.NET, but expect trouble. You might wish to upgrade it to VB6 first.

Fix required before upgrade. WebClasses upgrade to ASP.NET. You can upgrade Visual Basic 6.0 WebClass projects to ASP.NET 2003 Web Applications. Work required after upgrade.

Compatibility related optimization issues The following optimization issues are also helpful when considering the.NET upgrade. These rules are available in all editions of Project Analyzer. Function without type specification. A function does not have a defined return data type.

By default, the type is Variant. Variant needs more memory than other types.

Decide what type you need and write it to the function declaration. Besides, upgrading to VB.NET will be easier if you use explicit data types. Fix recommended before upgrade. Variable without type specification. A variable does not have a defined data type.

By default, the type is Variant. Variant needs more memory than other types. Decide what type you need and write it to the variable declaration.

Besides, upgrading to VB.NET will be easier if you use explicit data types. Fix recommended before upgrade. Compatibility related style issues The following style rules are also helpful when considering the.NET upgrade. These rules are available in all editions of Project Analyzer. ByVal/ByRef missing.

A parameter has no ByVal or ByRef declaration. The default in VB 3-6 is ByRef. In VB.NET, the default is ByVal.

Use of ByRef should be limited to where it is clearly required. ByVal is safer because it prevents values of passed parameters from being changed accidentally. Since bugs can easily occur with implicit ByRef, add either ByVal or ByRef to all parameters. Exception: explicit ByRef is unavailable in VB3. - If you migrate VB 3-6 code to VB.NET, there is yet another catch.

The VB.NET upgrade wizard adds ByRef automatically. Add ByVal/ByRef manually to prevent this. Fix recommended before upgrade. Option Explicit missing. A file is missing its Option Explicit statement. You should always use Option Explicit. Using it makes VB require declaration of all variables.

This way you avoid using unnecessary implicit Variants. Even better, you get rid of some nasty errors caused by typing errors and variables with similar names. The use of Option Explicit will also help in upgrading code to VB.NET. By forcing explicit variable declaration you prevent accidental use of late binding, which is harder to upgrade. Fix recommended before upgrade. Optional parameter missing default value. Optional parameters should declare an explicit default value so that users will know what to expect when omitting the parameter.

If you upgrade to VB.NET, the migration wizard will add a default value. The default for Variant parameters will be Nothing, not Missing, which can make your code behave differently. Can be fixed before or after upgrade. Variable/Parameter with generic type. A variable or parameter is declared as a generic type. While this is completely legal, it may lead to slow and error-prone code. VB may have to use 'late binding' because it doesn't know what kind of object to expect.

In late binding, calls to the object's members are slower and may result in a run-time error if the member doesn't exist. If you know what kind of an object the variable will contain, declare it as that type.

This is especially important if you plan to migrate existing VB 3-6 code to VB.NET. The.NET upgrade wizard cannot successfully convert all late-bound calls, resulting in manual work and errors.

Fix recommended before upgrade. 10 steps to migrate existing code to VB.NET Converting existing VB code to Visual Basic.NET is not just a matter of loading it to the new version.

Yes, VB.NET has its built-in migration tool, which does a good job converting your syntax. But that's just half of the work. Your project won't compile right away, you'll have a lot of issues ahead.

If you weren't prepared, you might decide you didn't want to migrate after all. Fortunately, you can prepare your code in advance. Actually, it is essential to work on your code before you load it in VB.NET. There is one program that fulfills the tool recommendations below. The code analysis and VB.NET Compatibility Check features of Project Analyzer are designed to help in moving from your current VB version to VB.NET.

The migration process • Decide whether to upgrade or not. There are program types that are best left in your current VB version. Projects that use UserControls, WebClasses, DHTML pages, VB's add-in model and other special techniques cannot easily be upgraded. Use a compatibility check tool to estimate what you can upgrade to VB.NET and how much work it will require. Alternatively, try to load your project in VB.NET and see the upgrade report for critical issues.

• Remove dead and duplicated code. Start by deleting all the code your programs don't use. It is not uncommon to have 30-40% dead code in a medium or large sized project. Migrating that code means extra burden and no benefits. Additionally, you should consider joining any duplicated functions to reduce the amount of code even further. — Now, how do you know what code is dead or duplicated?

Of course you can try to find that out manually, but if your goal is to minimize work, we strongly recommend that you get a decent source code analyzer to find the dead and duplicated code. • Upgrade problematic syntax and controls. Use of certain syntax and control versions will cause you a lot of trouble.

Take the Data control or VB5 Common Controls controls (ComCtl32.ocx or ComCt232.ocx), for example. You must upgrade to ADO data control or MsComCtl.ocx and MsComCt2.ocx, respectively. And, if you happen to be still in VB3 or VB4, you must port it to VB6 first. Obsolete syntax like GoSubs need to get removed, and you even need to prepare your conditional compilation (#If statements). Fortunately, you don't have to upgrade everything, only those things that the VB.NET upgrade wizard doesn't handle.

Use a compatibility check tool that recommends what to fix now and what to leave as is. • Fix your data declarations. If you've used a lot of Variants and undeclared variables, you're almost doomed. Now it's your final chance to add those Option Explicit statements and add proper type declarations to every Dim statement. Not only will this make your code more robust and optimized - it will also enable the upgrade wizard to properly port your code. Control object variable declarations are of special importance if you don't feel like writing half of your method and property calls again.

In addition, certain array and user-defined structure definitions are going to change. Use a source code analyzer that lists the declarations requiring a fix. • Load your code in VB.NET. Let the upgrade wizard do its job. You'll get a large report detailing the found upgrade issues, both fixed and unfixed. You'll get comments in the code near places that need to get worked on. What you're not getting is a list of undetected issues, of course.

• Try to compile your project. It won't succeed. You'll have a long list of compile errors. Now it really starts to pay off to be properly prepared. The list would be much longer if you hadn't prepared in advance. You might want to go back to step 1, 2, 3 or 4, fix some issues, and then go to step 5 and run the upgrade wizard again. • Compile & fix cycle.

Fix all the compiler issues. Finally, it runs. • Fix the commented issues. The upgrade wizard left comments in your code. Find them and do what they say.

Now it's also beneficial to review a list of expected behavior changes, like events that won't fire. Now you're back to daily life. Run and test your program to make sure it works as expected.

Comments are closed.