Conversion of a Visual Basic 6 Application to Visual Basic .NET

Total Page:16

File Type:pdf, Size:1020Kb

Conversion of a Visual Basic 6 Application to Visual Basic .NET FAK EKI Margaret Mburu and Robert Josefson Conversion of a Visual Basic 6 Application to Visual Basic .NET Subject C-level thesis Date/Term: 08-06-03 Supervisor: Donald F. Ross Examiner: Martin Blom Serial Number: C2008:06 Karlstads universitet 651 88 Karlstad Tfn 054-700 10 00 Fax 054-700 14 60 [email protected] www.kau.se Conversion of a Visual Basic 6 Application to Visual Basic .NET Margaret Mburu and Robert Josefson ii This report is submitted in partial fulfillment of the requirements for the Bachelor’s degree in Computer Science. All material in this report which is not our own work has been identified and no material is included for which a degree has previously been conferred. Approved 080603 Advisor: Donald F. Ross Examiner: Martin Blom iii Abstract This dissertation describes the process of converting an application from Visual Basic to a .NET programming language. This work was carried out on behalf of The Prevas Company [0] based in Karlstad, Sweden. Prevas provides IT solutions and industrial systems for several world leading companies such as Ericsson, Nokia, Siemens and many others. The objective behind the conversion of this application was to facilitate a more compatible and flexible option suitable for the other products using the .NET environment. In addition, Prevas felt that the Visual Basic 6 environment had grown rather old and outdated. The task was therefore to convert the source code from Visual basic 6 to .NET language and to determine the most efficient method for the conversion. The outcome of this project was to achieve a fully converted application using the .NET framework with its original functionality intact. iv Contents 1 Introduction ...................................................................................................................1 1.1 Document Outline ..................................................................................................2 2 Background ....................................................................................................................3 2.1 Visual Basic 6.0 ......................................................................................................3 2.2 Visual Basic 6.0 Features ........................................................................................3 2.3 .NET Framework ....................................................................................................4 2.3.1 Common Language Runtime 2.3.2 Compilation 2.3.3 .NET Framework - Class Library 2.3.4 Other .NET Related Languages 2.3.5 C# (SHARP) 2.4 Differences between Visual Basic 6 and Visual Basic.NET ....................................7 2.4.1 Multithreading 2.4.2 Object Oriented Feature 2.4.3 Console Applications 2.4.4 Memory Management 2.4.5 Runtime Environment 2.4.6 Data Types and Properties 2.4.7 Declaration and Initialization of Variables 2.4.8 Structures and User – Defined Types 2.4.9 Arrays 2.4.10 Fixed Length Strings 2.4.11 Structured Exception Handling 2.4.12 Compatibility 2.4.13 Security 2.4.14 Forms 3 Conversion Process ...................................................................................................... 15 3.1 Language Decision: .............................................................................................. 16 3.2 Before the Conversion .......................................................................................... 16 3.3 Results .................................................................................................................. 17 3.4 Compile Errors ..................................................................................................... 17 3.4.1 Property was not Upgraded (Compile error). 3.4.2 Declaring a parameter 'As Any' is not supported 3.4.3 Unable to determine which constant to upgrade vbNormal to 3.4.4 Number of Indices Exceeds the Number of Dimensions of the Indexed Array 3.4.5 Other Possible Compile Errors v 3.5 Upgrade Warnings: ............................................................................................... 26 3.5.1 Event may Fire when Form is initialized 3.5.2 Structure may require Marshalling Attributes to be passed as an Argument in this Declare Statement. 3.5.3 The Lower Bounds of a Collection has Changed 3.5.4 Other Possible Upgrade Warnings 3.5.5 Could not Resolve Default Property 3.6 Design Errors ....................................................................................................... 32 3.6.1 Property not Upgraded (Design error) 3.6.2 Other Possible Design Errors 3.7 Changing caching from string to XML ................................................................. 35 3.7.1 XML (Extensible Markup Language) 3.8 Issues Discovered During Testing ......................................................................... 37 3.8.1 VB.NET Registry Changes 3.9 Upgrade Summary ................................................................................................ 42 4 Results .......................................................................................................................... 44 4.1 Upgrade Checklist ................................................................................................ 44 4.1.1 Checklist 4.1.2 Before the Upgrade (Checklist: steps 1 and 2) 4.1.3 Application Version 2 (Checklist: step 3) 4.1.4 Test of application version 2 (Checklist: step 5) 4.1.5 Test of Application Version 3 (Checklist: steps 6, 7 and 8) 4.2 Project Overview .................................................................................................. 48 4.2.1 Knowledge 4.2.2 Software Tools 4.2.3 Planning 4.2.4 Project Summary 4.3 Project Evaluation ................................................................................................ 49 4.3.1 What was learned 4.3.2 Evaluation 5 Future Conversions ..................................................................................................... 51 5.1 Approach .............................................................................................................. 51 5.1.1 Partial Upgrade 5.1.2 Complete Upgrade 5.1.3 Complete Re-write 5.2 Preparations .......................................................................................................... 52 5.3 Changes ................................................................................................................ 53 5.3.1 Fixing Data Declaration 5.3.2 Obsolete Keywords 5.4 Tools .................................................................................................................... 54 5.4.1 Migration Cost Estimation Tool 5.4.2 Project analyzer and Compatibility Check Tool 5.5 Conclusions .......................................................................................................... 55 References ........................................................................................................................... 56 A Glossary ....................................................................................................................... 59 vi List of Figures Figure 2-1 The Common Language Runtime Environment[2] ........................................5 Figure 2-2 The Common Language Infrastructure[2] .......................................................6 Figure 2-3 Example Win32 Application in VB.NET ........................................................9 Figure 2-4 Example of Variant Data Type ..................................................................... 10 Figure 2-5 Variable declaration example ........................................................................ 11 Figure 2-6 Initialization and declaration in VB.NET ...................................................... 11 Figure 2-7 VB6 Structure ............................................................................................... 12 Figure 2-8 VB.NET Structure ........................................................................................ 12 Figure 2-9 VB.NET Array ............................................................................................. 13 Figure 3-1 WinHelp function ......................................................................................... 18 Figure 3-2 App.PrevInstance replacement ...................................................................... 19 Figure 3-3 The GetPrivateProfileString Function Declaration ........................................ 20 Figure 3-4 Example function with SQL Attributes ......................................................... 21 Figure 3-5 Example of Code with the vbNormal Constant ............................................. 22 Figure 3-6 Declaration of a multidimensional array ....................................................... 24 Figure 3-7 Life cycle of OLE VB6 drag and drop operation ........................................... 25 Figure 3-8 Subroutine not using IsInitializing ................................................................ 28 Figure 3-9 Subroutine using IsInitializing ...................................................................... 28 Figure 3-10 VB6 code without marshalling .................................................................... 29 Figure 3-11 Visual Basic .NET Code with Marshalling .................................................. 29 Figure 3-12 Modified code ............................................................................................ 29 Figure 3-13 Array Declaration ....................................................................................... 29 Figure 3-14 Imagelist ....................................................................................................
Recommended publications
  • MELT a Translated Domain Specific Language Embedded in the GCC
    MELT a Translated Domain Specific Language Embedded in the GCC Compiler Basile STARYNKEVITCH CEA, LIST Software Safety Laboratory, boˆıte courrier 94, 91191 GIF/YVETTE CEDEX, France [email protected] [email protected] The GCC free compiler is a very large software, compiling source in several languages for many targets on various systems. It can be extended by plugins, which may take advantage of its power to provide extra specific functionality (warnings, optimizations, source refactoring or navigation) by processing various GCC internal representations (Gimple, Tree, ...). Writing plugins in C is a complex and time-consuming task, but customizing GCC by using an existing scripting language inside is impractical. We describe MELT, a specific Lisp-like DSL which fits well into existing GCC technology and offers high-level features (functional, object or reflexive programming, pattern matching). MELT is translated to C fitted for GCC internals and provides various features to facilitate this. This work shows that even huge, legacy, software can be a posteriori extended by specifically tailored and translated high-level DSLs. 1 Introduction GCC1 is an industrial-strength free compiler for many source languages (C, C++, Ada, Objective C, Fortran, Go, ...), targetting about 30 different machine architectures, and supported on many operating systems. Its source code size is huge (4.296MLOC2 for GCC 4.6.0), heterogenous, and still increasing by 6% annually 3. It has no single main architect and hundreds of (mostly full-time) contributors, who follow strict social rules 4. 1.1 The powerful GCC legacy The several GCC [8] front-ends (parsing C, C++, Go .
    [Show full text]
  • App Development Courses/Certificate Mississippi Curriculum Framework
    App Development Courses/Certificate Mississippi Curriculum Framework Apple/Swift Same CIP as IST 11.0201 Computer Programming/ Programmer, General Same CIP as IST 11.0202 Computer Programming, Specific Applications. July 2019 Published by: Mississippi Community College Board Division of Workforce, Career, and Technical Education 3825 Ridgewood Road Jackson, MS 39211 Phone: 601‐432‐6155 Email: [email protected] 1 FACULTY WRITING TEAM MEMBERS Brandon Sesser, East Mississippi Community College David Rose, Hinds Community College Roderick Kwan, Hinds Community College Kathy Boyte, Hinds Community College Kenneth Boyte, Hinds Community College Cody Robertson, Jones County Junior College Robin Hayes, Mississippi Gulf Coast Community College Dr. James Gruich, Mississippi Gulf Coast Community College Natasha Lewis, Northeast Mississippi Community College Nick Jackson, Northeast Mississippi Community College Tony Bouthwell, Meridian Community College Daniel Ethridge, Meridian Community College ADMINISTRATOR WRITING TEAM MEMBERS Joe Cook, Assistant Dean, East Mississippi Community College Dr. Richie McAlister, Vice President, Meridian Community College Lori Smith, Coordinator, Meridian Community College Joseph Knight, Dean, Business Development, Meridian Community College Sherry Franklin, Associate Vice President, Hinds Community College Rod Tolbert, Dean, Jones County Junior College Jason Mattox, Associate Vice President Northeast Mississippi Community College John Shows, Associate Vice President, Mississippi Gulf Coast Community College Dr.
    [Show full text]
  • Teaching Python for Data Science: Collaborative Development of a Modular & Interactive Curriculum
    bioRxiv preprint doi: https://doi.org/10.1101/2021.06.17.448726; this version posted June 18, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. Teaching Python for Data Science: Collaborative development of a modular & interactive curriculum Marlena Duda1 Kelly L. Sovacool1 Negar Farzaneh1,11 Vy Kim Nguyen1,8 Sarah E. Haynes6 Hayley Falk1 Katherine L. Furman3,4 Logan A. Walker5,1 Rucheng Diao1 Morgan Oneka1 Audrey C. Drotos10 Alana Woloshin7 Gabrielle A. Dotson1 April Kriebel1 Lucy Meng9 Stephanie N. Thiede2 Zena Lapp1,* Brooke N. Wolford1,* 30 Apr. 2021 1 Department of Computational Medicine & Bioinformatics, University of Michigan 2 Department of Microbiology & Immunology, University of Michigan 3 Neuroscience Graduate Program, University of Michigan 4 Michigan Neuroscience Institute, University of Michigan 5 Biophysics Graduate Program, University of Michigan 6 Department of Pathology, University of Michigan 7 School of Information, University of Michigan 8 Department of Environmental Health Sciences, University of Michigan 9 Department of Electrical Engineering & Computer Sciences, University of California, Berkeley 10 Kresge Hearing Research Institute, Department of Otolaryngology–Head and Neck Surgery, University of Michigan 11 Michigan Center for Integrative Research in Critical Care, University of Michigan * Correspondence: Zena Lapp <[email protected]>, Brooke N. Wolford <[email protected]> Summary We are bioinformatics trainees at the University of Michigan who started a local chapter of Girls Who Code to provide a fun and supportive environment for high school women to learn the power of coding.
    [Show full text]
  • Let's Code: a Kid-Friendly Interactive Application Designed to Teach
    (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 10, No. 7, 2019 Let’s Code: A Kid-friendly Interactive Application Designed to Teach Arabic-speaking Children Text-based Programming Tahani Almanie1, Shorog Alqahtani2, Albatoul Almuhanna3, Shatha Almokali4, Shaima Guediri5, Reem Alsofayan6 Information Systems Department King Saud University, Riyadh, Saudi Arabia Abstract—Programming is the cornerstone for the be applied in both their personal and professional lives. Liao development of all of the technologies we encounter in our daily and Bright found that programming increases brain abilities lives. It also plays an important role in enhancing creativity, involved in learning and progress [3]; in their study, students problem-solving, and logical thinking. Due to the importance of with experience in the field of programming achieved 16% programming in combination with the shortage of Arabic content higher on cognitive ability tests than students who did not have that aims to teach children programming, we decided to develop programming experience. Let’s Code, an interactive mobile-based application designed for Arabic-speaking children from 8 to 12 years old. The application On this basis, we built an edutainment application that aims focuses on the basics of programming such as data types, to teach Arab children the basics of Python, which is a simple variables, and control structures using the Python programming object-oriented programing language. We chose Python language through a simple, attractive, and age-appropriate because of its ease of use; Python is designed to be more design. The application presents its users with an interesting readable and easier to understand than any other scripting storyline that involves a trip to space with “Labeeb”, a robot language.
    [Show full text]
  • Essential Delphi – Copyright 1996-2002 Marco Cantù – 1
    Marco Cantù's Essential Delphi – Copyright 1996-2002 Marco Cantù – www.marcocantu.com/edelphi 1 MMARCOARCO CCANTÙANTÙ''SS EESSENTIALSSENTIAL DDELPHIELPHI A Friendly Introductory Guide to Borland Delphi http://www.marcocantu.com/edelphi Copyright 1996-2002 Marco Cantù Revision 1.03 - April 13, 2002 Marco Cantù's Essential Delphi – Copyright 1996-2002 Marco Cantù – www.marcocantu.com/edelphi 2 INTRODUCTION fter the successful publishing of the e-book Essential Pascal (available on my web site at the address http://www.marcocantu.com/epascal), I decided to follow up with an Aintroduction to Delphi. Again most of the material you'll find here was in the first editions of my “printed” book Mastering Delphi, the best selling Delphi book I have written. Due to space constraints and because many Delphi programmers look for more advanced information, in the latest edition this material was completely omitted. To overcome the absence of this information, I have started putting together this second on- line book, titled Essential Delphi. Copyright The text and the source code of this book are copyrighted by Marco Cantù. Of course, you can use the programs and adapt them to your own needs with no limitation, only you are not allowed to use them in books, training material, and other copyrighted formats without my permission (or in case you are using limited portions, referring to the original). Feel free to link your site with this one, but please do not duplicate the material (on your web site, on a CD) as it is subject to frequent changes and updates. Passing a copy to a friend, occasionally, is certainly something you can do if you do not modify it in any way.
    [Show full text]
  • Ksc-It-G Computer Programming Resources 2018
    https://ntrs.nasa.gov/search.jsp?R=20190002508 2019-08-30T21:30:00+00:00Z KSC-IT-G National Aeronautics and Space Administration RELEASE DATE: NOVEMBER 16, 2018 COMPUTER PROGRAMMING RESOURCES 2018 Brandeis Bellamy, Intern NASA Internships and Fellowships (NIFs) IT-G Technical Integration Office Information Technologies and Communications Services Directorate NASA Kennedy Space Center NOVEMBER 16, 2018 Page 1 of 104 REVISION AND HISTORY PAGE NAME WHAT WAS CHANGED/ADDED DATE Brandeis Bellamy Created Entire Document. Input from Dan Simons on sections: Nov 2018 “PF Project Structure” and “Additional Competencies Needed” NOVEMBER 16, 2018 Page 2 of 104 Table of Contents REVISION AND HISTORY PAGE ..................................................................................................................... 2 ACRONYMS ................................................................................................................................................... 9 DEFINITIONS & DESCRIPTIONS .................................................................................................................. 10 Angular .................................................................................................................................................... 10 ASP.NET ................................................................................................................................................... 10 C Sharp ...................................................................................................................................................
    [Show full text]
  • FALL 2020 the Gateway Guide
    The Gateway Guide FALL 2020 The Gateway Guide CONTACT GSGC WHAT’S INSIDE VISIT US A Message From Our CEO ........................ 3 1000 Shearer Avenue Jacksonville, FL 32205 Getting Started ........................................... 4 Girl Programs .............................................. 5 CALL US (877) 764-5237 Daisies ................................................ 6 Brownies ............................................ 7 Juniors ................................................ 8 Cadettes ............................................. 9 EMAIL US Seniors ............................................... 10 [email protected] Ambassadors ................................... 11 Program Descriptions ............................... 12 FIND US ONLINE girlscouts-gateway.org Annual Permission Form ......................... 32 SHOP GIRL SCOUT GEAR girlscoutshop.com/GATEWAY-COUNCIL @gsgcfl @girlscoutsgc @gsgc A Message From Our CEO Dear Girl Scouts, For many of us, 2020 has been a year like we have never experienced before. We have faced new challenges as girls, parents, volunteers, leaders and educators that have led us to redefine parts of the Girl Scouting experience in a way we never could have predicted. While some may have viewed the trials of this year as roadblocks, we saw them as opportunities to explore new and exciting ways for our troops to experience all that Girl Scouts has to offer. We introduced new virtual programming, reimagined summer camp to offer innovative online opportunities and hosted virtual award
    [Show full text]
  • Comparative Studies of 10 Programming Languages Within 10 Diverse Criteria Revision 1.0
    Comparative Studies of 10 Programming Languages within 10 Diverse Criteria Revision 1.0 Rana Naim∗ Mohammad Fahim Nizam† Concordia University Montreal, Concordia University Montreal, Quebec, Canada Quebec, Canada [email protected] [email protected] Sheetal Hanamasagar‡ Jalal Noureddine§ Concordia University Montreal, Concordia University Montreal, Quebec, Canada Quebec, Canada [email protected] [email protected] Marinela Miladinova¶ Concordia University Montreal, Quebec, Canada [email protected] Abstract This is a survey on the programming languages: C++, JavaScript, AspectJ, C#, Haskell, Java, PHP, Scala, Scheme, and BPEL. Our survey work involves a comparative study of these ten programming languages with respect to the following criteria: secure programming practices, web application development, web service composition, OOP-based abstractions, reflection, aspect orientation, functional programming, declarative programming, batch scripting, and UI prototyping. We study these languages in the context of the above mentioned criteria and the level of support they provide for each one of them. Keywords: programming languages, programming paradigms, language features, language design and implementation 1 Introduction Choosing the best language that would satisfy all requirements for the given problem domain can be a difficult task. Some languages are better suited for specific applications than others. In order to select the proper one for the specific problem domain, one has to know what features it provides to support the requirements. Different languages support different paradigms, provide different abstractions, and have different levels of expressive power. Some are better suited to express algorithms and others are targeting the non-technical users. The question is then what is the best tool for a particular problem.
    [Show full text]
  • Visual Studio Code
    Visual Studio Code Tips & Tricks Vol. 1 1st Edition – March 2016, Revision 1 (April 2016) © Microsoft 2016 All rights reserved. This document is for informational purposes only. Microsoft Deutschland GmbH · Konrad-Zuse-Str. 1 · D-85716 Unterschleißheim Tel. +49 (0)89 31760 · www.microsoft.com · www.techwiese.de Authors: Tobias Kahlert and Kay Giza · Microsoft Germany Editor: Mathias Schiffer Localization: textoso · www.textoso.com Page 1 of 26 This book expresses the authors’ views and opinions. This document always up-to-date at: http://aka.ms/VSCodeTipsTricks Contents Visual Studio Code? ................................................................................................................................. 4 Preface ..................................................................................................................................................... 5 What is Visual Studio Code? .................................................................................................................... 6 Tip 1 – Getting the Latest and Greatest as a VS Code Insider ................................................................. 6 Tip 2 – Multiple Cursors .......................................................................................................................... 8 Tip 3 – Using the Command Palette to Control VS Code ........................................................................ 8 Tip 4 – Selecting a Language for a File ...................................................................................................
    [Show full text]
  • A Smart Book Web Development in Pascal with Smart Mobile Studio
    A Smart Book Web Development in Pascal with Smart Mobile Studio Primož Gabrijelčič ©2012 - 2013 Primož Gabrijelčič Tweet This Book! Please help Primož Gabrijelčič by spreading the word about this book on Twitter! The suggested hashtag for this book is #asmartbook. Find out what other people are saying about the book by clicking on this link to search for this hashtag on Twitter: https://twitter.com/search/#asmartbook Also By Primož Gabrijelčič Parallel Programming with OmniThreadLibrary Параллельное программирование с OmniThreadLibrary Programación Paralela con OmniThreadLibrary Contents Credits ............................................... i Introduction ............................................ ii Sample Code ........................................... iii Formatting Conventions .................................... iv Work in Progress ........................................ v Advertisement .......................................... vi Release Notes ........................................... vii 1 Prerequisites .......................................... 1 2 Getting Started ......................................... 2 2.1 Brief Introduction to Smart Mobile Studio ........................ 3 2.1.1 Project Types .................................... 3 2.1.2 Visual Project .................................... 3 2.1.3 Game Project .................................... 3 2.1.4 Console Project ................................... 3 2.2 Supported Browsers .................................... 4 3 Smart IDE ...........................................
    [Show full text]
  • Developing Ios Apps Developing Ios Apps Today
    Start Developing iOS Apps TTodayoday Contents Introduction 5 Setup 6 Get the Tools 7 Tutorial: Basics 8 Create a New Project 9 Get Familiar with Xcode 11 Run iOS Simulator 12 Review the Source Code 14 Create a Storyboard 17 Add a Scene to Your Storyboard 19 Test Your Changes 23 Build the Basic Interface 23 Recap 28 Structuring an App 29 App Development Process 30 Defining the Concept 30 Designing a User Interface 31 Defining the Interaction 31 Implementing the Behavior 32 Objects Are Building Blocks for Apps 32 Classes Are Blueprints for Objects 32 Objects Communicate Through Messages 33 Protocols Define Messaging Contracts 34 Incorporating the Data 34 Use the Right Resources 34 Incorporate Real Data 35 Designing a User Interface 36 The View Hierarchy 36 Building an Interface Using Views 37 2012013-10-223-10-22 | CopyrigCopyrightht © 20120133 Apple Inc. All RightRightss ReserReserved.ved. 22 Contents Use Storyboards to Lay Out Views 38 Use Inspectors to Configure Views 40 Use Auto Layout to Position Views 41 Defining the Interaction 42 View Controllers 42 Actions 43 Outlets 44 Controls 44 Navigation Controllers 45 Use Storyboards to Define Navigation 45 Tutorial: Storyboards 48 Adopt Auto Layout 49 Creating a Second Scene 51 Display Static Content in a Table View 54 Add a Segue to Navigate Forward 56 Create Custom View Controllers 64 Unwind a Segue to Navigate Back 67 Recap 70 Implementing an App 71 Incorporating the Data 72 Designing Your Model 72 Implementing Your Model 73 Using Design Patterns 74 MVC 74 Target-Action 75 Delegation 75 Working with Foundation 77 Value Objects 77 Strings 78 Numbers 79 Collection Objects 80 Arrays 80 Sets 84 Dictionaries 85 2012013-10-223-10-22 | CopyrigCopyrightht © 20120133 Apple Inc.
    [Show full text]
  • Ksc-It-G Computer Programming Resources 2018
    KSC-IT-G National Aeronautics and Space Administration RELEASE DATE: NOVEMBER 16, 2018 COMPUTER PROGRAMMING RESOURCES 2018 Brandeis Bellamy, Intern NASA Internships and Fellowships (NIFs) IT-G Technical Integration Office Information Technologies and Communications Services Directorate NASA Kennedy Space Center NOVEMBER 16, 2018 Page 1 of 104 REVISION AND HISTORY PAGE NAME WHAT WAS CHANGED/ADDED DATE Brandeis Bellamy Created Entire Document. Input from Dan Simons on sections: Nov 2018 “PF Project Structure” and “Additional Competencies Needed” NOVEMBER 16, 2018 Page 2 of 104 Table of Contents REVISION AND HISTORY PAGE ..................................................................................................................... 2 ACRONYMS ................................................................................................................................................... 9 DEFINITIONS & DESCRIPTIONS .................................................................................................................. 10 Angular .................................................................................................................................................... 10 ASP.NET ................................................................................................................................................... 10 C Sharp .................................................................................................................................................... 10 Cascading Style Sheets (CSS) ..................................................................................................................
    [Show full text]