Senin, Juli 30, 2007

Migrating to Visual Basic.NET from Visual Basic 6 (6) - Control Changes in Visual Basic .NET

Migrating to Visual Basic.NET from Visual Basic 6 - Control Changes in Visual Basic .NET
(Page 6 of 7 )

New controls and objects in Visual Basic .NET replace the intrinsic controls, objects, and collections in Visual Basic 6.0. In some cases, the names have changed; in many cases the properties, methods, and events are different

Control Array changes in Visual Basic .NET

In Visual Basic 6, control arrays could be used for controls of same types. Visual Basic.NET does not support the control arrays.. Visual Basic.NET event handler allows an event to handle multiple controls thereby allowing the programmer to make a group of different controls that share same events.

For example, one single event handler could be written for Click event of a Button control or a CheckBox control in Visual Basic.NET, by specifying names of the controls in the “Handles “ clause of the event handler.

Though this means that Visual Basic..NET does not support index property, it can be easily simulated using Tag property of the control if the need be.

Menu Changes in Visual Basic.NET

In Visual Basic.NET, the menus are designed using MainMenu control and context menus are designed using ContextMenu control.

MDI Changes in Visual Basic.NET

In Visual Basic 6, MDI form has to be added to the project and other forms’ MDIChild property needs to be set to true. In Visual Basic.NET, any form can be made an MDI parent by IsMDIContainer property to true

Dialog Boxes in Visual Basic.NET

Instead of a CommonDialogControl like Visual Basic 6, Visual Basic.NET sports different pre defined dialog controls To show the forms modally, Visual Basic.NET uses ShowModal method.

General changes in Visual Basic.NET
Visual Basic .NET does not support the OLE container control; you should avoid using this control in your Visual Basic 6.0 applications.
There is no shape control in Visual Basic .NET. Square and rectangular shapes will be upgraded to labels, while ovals and circles cannot be upgraded. You should avoid using these in your applications.
There is no line control in Visual Basic .NET. Horizontal and vertical lines are upgraded to labels. Diagonal lines are not upgraded, and you should avoid using them.
Visual Basic .NET has a new set of graphics commands that replace the Form methods Circle, CLS, PSet, Line, and Point. Because the new object model is quite different from Visual Basic 6.0, these methods cannot be upgraded.
For the Timer control, setting the Interval property to 0 does not disable the timer; instead the interval is reset to 1. In your Visual Basic 6.0 projects, you should set Enabled to False instead of setting the Interval to 0.
Visual Basic.NET does not support DDE
Visual Basic.NET does not support Form.PrintForm method
To ensure that the form upgrades to right size, default ScaleMode twips should be used.
Windows Forms support only true-type and open-type fonts. Other fonts than these, if used in the applications will be changed to default font MS Sans Serif

Tidak ada komentar: