VB.Net
  Home arrow VB.Net arrow Page 4 - 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  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
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 / 37
    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

    Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!

    Migrating to Visual Basic.NET from Visual Basic 6 - Upgrade Report


    (Page 4 of 7 )

    We will have to check up with the Upgrade Report created by the Upgrade Wizard to find out what has happened. The report will be available in the Solutions Explorer. Double click it to open. Expand the Form2 node and you will see that the Upgrade Wizard has not been able to resolve the caption property of the Label1 on Form1.

    Visual Basic .NET offers a different Windows Forms package. Which is provided by .NET framework.. Windows Forms and Windows Forms Controls provide a richer interface for developing Windows applications. This means that there are a number of differences between Visual Basic 6 forms and controls and Visual Basic.NET.

    Now, open Form1 in the designer by double clicking on it. First thing to be noticed is the ToolTip Control. Remember Visual Basic.NET does not have ToolTip property for the objects? So, what it is trying to tell you is, if you want a ToolTip, add the control to the form.

    Code changes

    Let us now examine the code. The End command Button and Command2 Button do not require any modifications to the code. So, has the Upgrade Wizard really done any modifications to the code at all? Check the Form2 Command Button. Where is our call to the Show method of Form2?

    Aha, here is where we see the real difference in Visual Basic 6 and Visual Basic.NET approach. Visual Basic.NET treats Forms as objects that belong to a class just like any other object and has to be instantiated before calling its methods. The DefInstance property creates an instance of Form2. This could have been handled by using New keyword, but this is just the Wizard’s choice!

    Now, open the Form2 code and rectify the error.

    Change this code:

    Label1.Text = frmdisplay.Label1.Caption

    To

    Label1.Text = Form1.DefInstance().Label1.Text

    The application now runs smoothly.

    Now, why did we have to do the modifications ourselves? Why could the wizard not do it? There are two solid reasons for this.

    1) There is no exact one to one corresponding way to write the code between Visual Basic 6 and Visual Basic.NET

    2) Visual Basic 6 code supports late binding and Visual Basic.NET does not.

    Whenever the code encounters situations where it can not change the code, it prefers to draw programmer’s attention to the problem and let the programmer do the job himself. There are four different types of warnings the wizard issues with the help of TO DO comments.
    • UPGRADE_ISSUES: Indicates compilation errors. These need to be corrected before the application can be compiled and run
    • UPGRADE_TODO: Though the project compiles well, there will be run time errors
    • UPGRADE_WARNINGS: Though the project compiles, there may be run time errors
    • UPGRADE_NOTE: This is a comment for information only. II tells us about any significant modifications handled by the wizard.
    Also, when we open the code for Form1, we see it presented differently. Again, Option Explicit is automatically turned on and Option Strict turned off, allowing you to do some implicit conversions.

    The block labeled Windows Form Designer also contains code for the design of the form. It tells us how the components on the form are generated, their locations, sizes etc. Though we can manually change this code, it is always a better idea to leave it to the designer. If we need any changes in the look and feel of the form, we could always go back to the designer and make the changes, isn’t it?

    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-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway