Emailid
Password
         
  
    Forgot password

New user Sign Up
 

Visual Basic six and Transferring to Visual Basic.NET part III

       Current Rating:  0%                                                     Total Members Rated:  0
                                                                     Send To Friend

  

Visual Basic six and Transferring to Visual Basic.NET part III

 

 

Promotion of the Report


The report will be available in the Solutions Explorer. We will have to check up with the Upgrade Report created by the Upgrade Wizard to find out what has happened. 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.

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

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. If you want a ToolTip, add the control to the form.


Modification of 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. Search for the Show method of Form2

Here we see the real difference in Visual Basic 6 and Visual Basic.NET approach. 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! 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.


Code Alteration:

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 it.

i. No exact one to one corresponding way to write the code between Visual Basic 6 and Visual Basic.NET

ii. Visual Basic six code supports late binding and Visual Basic.NET does not.

It prefers to draw programmer's attention to the problem and let the programmer do the job himself whenever the code encounters situations where it can not change the code.

 

Four types of warnings the wizard issues with the help of TO DO comments are:

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.

 

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

When we open the code for Form1, we see it presented differently. Option Explicit is automatically turned on and Option Strict turned off, allowing you to do some implicit exchanges.

 

Conclusion



The block labeled Windows Form Designer also contains code for the design of the form. 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. It tells us how the components on the form are generated, their locations, sizes etc.


                           Rate This Article:   

Author is Offline
  Author: Pamela Teipel
       


Comments Posted
Label
Subject Author Status Date

 

Post Comment

Related Articles
Software Development Outsourcing (Offshore ) to India
Make your web site ‘perfect and Search Engine Friendly for Google and Yahoo
Attract your Web site visitors!
How to improve your content
Do you want to increase your website traffic?



Home | About Us | Site Map | Privacy Policy | Submit Links