VB.Net
  Home arrow VB.Net arrow Page 5 - Migrating to Visual Basic.NET from Visual ...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VB.NET

Migrating to Visual Basic.NET from Visual Basic 6
By: Vaijayantee Sateesh Kamat
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 40
    2002-04-08

    Table of Contents:
  • Migrating to Visual Basic.NET from Visual Basic 6
  • Upgrading to Visual Basic.NET
  • Upgrade Report and Comments
  • Upgrade Report
  • Programming Recommendations
  • Control Changes in Visual Basic .NET
  • Summary

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Migrating to Visual Basic.NET from Visual Basic 6 - Programming Recommendations


    (Page 5 of 7 )

    In general, it will ease the life of the programmers who want to upgrade their Visual Basic 6 applications, if they keep following points in mind before they upgrade the applications. If they make some necessary changes in advance to their Visual Basic 6 application the upgrade process will definitely be smoother. Let us just go through some of the points that will help application your applications in Visual Basic 6 smoothly

    Binding

    Though both, Visual Basic 6 as well as Visual Basic.NET support late binding, it can cause problems in upgrade process when resolving default problems. In such cases, it is better to re-write the code using early binding

    Let us examine the code written Visual Basic 6 using late binding.

    Dim ObjLbl as Object

    Set ObjLbl = Me.Label1

    ObjLbl.Caption = "Hello"


    This code works fine with Visual Basic 6. But, when we try to upgrade it to Visual Basic.NET, the caption property of a Label needs to be changed to Text property. The ObjLbl is type-less and the wizard has no way of knowing what properties it is supposed to change. If you change the first line of the code to “Dim ObjLbl as Label” then the code upgrades just fine.

    Dates

    Another thing to remember is the Date data type. We should use Date data type for storing dates because, unlike Visual Basic 6, Visual Basic.NET does not support double data type for storing dates.

    Default Properties

    It will help smoother upgrade if you specify default properties of the controls used in the code. In the above-mentioned code, using ObjLbl.Caption=”Hello” instead of using just ObjLbl = “Hello” will help the wizard in resolving the default property. Though the wizard will try to find out the default properties, it will not be always be successful. Again late bound default properties will inevitably fail.

    Zero Bound Arrays

    Visual Basic 6 supports arrays with lower bound even other than zero. You have to set the lower bound with LBound statement. When an application with array other than zero is upgraded, the Upgrade Wizard issues an UPGRADE_WARNING saying that the array is converted to LBound zero.

    Windows APIs

    As the underlying OS is the same, most of the API calls can be used in the same way. Some data types like Long are different than the Visual Basic 6 though here the Upgrade Wizard can take care of the changes. In some cases like Fixed Length Strings that Visual Basic.NET does not inherently support, can cause a problem for the Upgrade Wizard. Also, APIs that support thread creation or windows subclassing can cause a problem in Visual Basic.NET

    Considerations for Forms and Controls

    In general, we can say that keeping following changes in mind will help us in upgrading the Visual Basic 6 projects.

    Forms tasks changes in Visual Basic.NET
    • Unlike Visual Basic 6, the tab order can be set using the Tab Order from View menu in Visual Basic .NET
    • Determining modifier keys for mouse and keyboard events is very different from Visual Basic 6. We have to find out value of the key using the keys enumeration and compare it to the class’s modifier method.
    • When we are aligning and sizing a control in Visual Basic 6, the last control in selection is the reference whereas in Visual Basic .NET it is the first control
    • For deciding the runtime position of the Form, Visual Basic 6 uses Startup property while Visual Basic .NET uses StartPosition property. Also, instead of Left and Top properties, Visual Basic.NET uses Location property by setting it to a point object
    • In Visual Basic .NET a GroupBox control is used instead of a Frame
    • In Visual Basic .NET, a controls collection used instead of a control array to iterate through the controls on the form.

    More VB.Net Articles
    More By Vaijayantee Sateesh Kamat


       · That was a very precise and helpful piece of information. My sincere thanks to the...
     

    VB.NET ARTICLES

    - MyClass - Implementing Polymorphism in VB.Net
    - Building a News Ticker Using VB.Net
    - Everything You Wanted to Know About Forms In...
    - Building Assemblies with VB.Net
    - Simple VB.NET Notify Icon with Panel Applica...
    - Regular Expressions in .NET
    - String Encryption With Visual Basic .NET
    - Deploying Applications in VB.NET: Part 1/2
    - Watching Folder Activity in VB.NET
    - Creating A Windows Service in VB.NET
    - Implementing The Google Web Service In VB.NET
    - Migrating to Visual Basic.NET from Visual Ba...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek