Conversion from Visual Basic 6.0 to Visual Basic. NET (4)

Source: Internet
Author: User

Upgrade

Wizard

These statements are not automatically upgraded, so there will be an upgrade error marked with "(statement) is not supported" [(statement) not supported. For example, the following code:

A = VarPtr (B)

After the upgrade, it will be changed:

UPGRADE_ISSUE: Function VarPtr () is not supported

A = VarPtr (B)

This will also cause compilation errors.

File I/O

Visual

Basic 6.0 includes file I/O statements.

Visual Basic. NET

Use file I/O operations through the class library. Delete the file I/O statement from the language to use different I/O libraries in Visual Basic. NET. If there are file I/O statements in the language, the code will be more cumbersome, and the identifiers Open, Close, Print, and Write will become reserved words.

Upgrade

Wizard

The file I/O statement is upgraded to the corresponding function. For example, the following code:

Open nput)

Debug. Print

Visual

Basic 6.0 Debug. Print outputs a line of text to the "now" window.

Visual Basic. NET

Debug. WriteLine outputs a line of text to the "output" window. You can also use the Debug. Write method to output text to the "output" window without line breaks.

Upgrade

Wizard

Upgrade Debug. Print to Debug. WriteLine.

Resource file

Visual

Basic 6.0 Visual Basic 6.0 supports one. res file for each project.

Visual Basic. NET

Visual Basic. NET supports multiple resource files. You can bind a form to automatically retrieve resources from the new. resX format resource file. Any CLR class can be stored in the. resX file.

Upgrade

Wizard

The file is upgraded from. res to. resX, and the code is modified to load from the. resX file.

Windows Applications

Visual Basic Form

Visual

Basic 6.0 Visual Basic 6.0 has its own form package, which is used to create a graphical Windows application.

Visual Basic. NET

For Visual Basic. NET, Windows Forms are a new form package. Windows Forms are constructed based on the Common Language Runtime (CLR), so Windows Forms can take full advantage of all CLR functions. In particular, because Windows Forms packages have the advantages of deployment, application separation, version, and code access security, you can construct a Windows-based client application, its deployment and updates are much easier. You can even construct a Windows form application with the same browser deployment scheme as HTML. Like the granularity control of code access security, these features make the use of Windows Forms controls in browsers very eye-catching.

Windows Forms Set also provides many new functions for Visual Basic developers, such as Visual inheritance, improved localization and access support, automatic resizing of forms, and local menu editor.

Upgrade

Wizard

Upgrade Visual Basic Form to Windows form.

PrintForm Method

Visual

The Basic 6.0 PrintForm method sends the image of the Form object to the printer in one byte. However, this printing function does not work properly in some forms.

Visual Basic. NET

In Windows Forms, Visual Basic. NET uses a printing framework that allows you to quickly generate complex printed documents. It also includes the built-in "print preview" dialog box.

Upgrade

Wizard

The PrintForm method call flag has an upgrade error. You can use the new printing framework to create a printing document, or even take a screen snapshot of the application window and print it.

Circle, Cls, PSet, Line, and Point methods

Visual

Basic 6.0 uses the Circle, Cls, PSet, Line, and Point methods to draw or clear images in a form.

Visual Basic. NET

Windows Forms have a new set of graphical commands to replace Circle, Cls, PSet, Line, and Point. Windows form package is built on the basis of GDI +. GDI + is a rich library of 2D text and image processing graphics. It can be used directly in Visual Basic. NET. In earlier versions, Visual Basic programmers were not able to use these functions without using Declare statements and GDI APIs. Although this change is relatively large, the flexibility and powerful features of GDI + allow programmers to quickly develop applications, and using Visual Basic of previous versions will take a lot of work.

Upgrade

Wizard

There is an upgrade error in the call Mark for these methods. In System. Drawing, you can write down the graphic call using the GDI + class.

Name attribute

Visual

The Basic 6.0 Name attribute returns the Name used in the code to identify a form, control, or data access object. Read-Only at runtime.

Visual Basic. NET

Windows forms do not support the Name attribute of forms and controls at runtime. If you need to iterate the Controls set to find the control with a specific name, you can use the System. Reflection class of the. NET Framework to find the control.

Upgrade

Wizard

The Name attribute of the control indicates an upgrade error.

Caption attributes

Visual

Basic 6.0 some controls (such as labels) have the Caption attribute to determine the text displayed in the control or beside the control. Other controls (such as TextBox) have the Text attribute to determine the Text contained in the control.

Visual Basic. NET

In Windows Forms, all controls are called "Text. This simplifies the use of controls.

Upgrade

Wizard

Changes the control's Caption attribute to Text.

Tag attributes

Visual

The Basic 6.0 Tag attribute can return or set an expression used to store the extra data required by the program.

The built-in controls cannot be extended in Visual Basic 6.0, so Tag attributes are required.

Visual Basic. NET

In Windows Forms, you can use inheritance to extend the built-in controls and add your own properties. Using inheritance as a tool makes built-in controls more flexible. You can not only add any multiple attributes as needed, but also set these attributes as strong attributes.

Upgrade

Wizard

The Tag control of the Windows Forms extension in the compatible library is used to provide the same functions.

ScaleMode attributes

Visual

The Basic 6.0 ScaleMode attribute returns or sets a value to indicate the coordinate measurement unit of the Object When graphical methods or positioning controls are used.

Visual Basic. NET

Windows Forms always use pixels as measurement units, which simplifies the layout of the forms.

In addition, Windows Forms use better methods to adjust the size. The AutoScaleBaseSize attribute automatically adjusts the scaling ratio based on the screen resolution (dpi) and font size.

Upgrade

Wizard

The code using twip () (default ScaleMode setting in Visual Basic 6.0) will be completely upgraded. If the ScaleMode is not, you will encounter a problem in size adjustment.

For a full description of this topic, see the White Paper prepare to upgrade the Visual Basic 6.0 Application to Visual Basic. NET ).

Font

Visual

Basic 6.0 forms and controls can use any Windows Font.

Visual Basic. NET

Only TrueType or OpenType fonts can be used for forms and controls. Using these types of fonts can solve many inconsistencies between different operating system versions and Their localized versions. These fonts also have features that do not depend on the device resolution or reverse sample.

Upgrade

Wizard

If you use a non-TrueType font in the application, the font will change to the default Windows form font, but the format (size, bold, italic, and underline) will be lost.

Screen. MousePointer attributes

Visual

The MousePointer attribute of the Basic 6.0 Screen Object can return or set a value to indicate the type of mouse pointer that is displayed when the mouse is running outside the application form.

Visual Basic. NET

If the mouse pointer is in a form inside the application, you can operate it. If the mouse pointer is outside the application, it cannot. We will continue to improve its functions in future versions.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.