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

Source: Internet
Author: User
Tags unsupported

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.

 

 

 

Upgrade

Wizard

 

 

Use the sceen. mousepointer statement to mark an upgrade error.

 

 

Timer. interval attribute

Visual

The interval attribute of the basic 6.0 Timer control returns or sets the number of milliseconds between timer event calls. If it is set to 0, the timer control is disabled. The enabled attribute is also used to determine whether the timer is running. This can cause confusion because the timer cannot be enabled even if the enabled attribute is true and the time interval is 0.

 

 

 

Visual Basic. net

 

 

The interval attribute indicates the time (in milliseconds) between the timer scales ). This attribute cannot be set to 0. The enabled attribute specifies whether the timer is running. This method is more direct and can simplify the timer object encoding.

 

 

 

Upgrade

Wizard

 

 

If timer. interval is set to 0, the Upgrade Wizard can detect this situation and Mark timer. interval as an upgrade error.

 

We recommend that you use timer. enabled in the Visual Basic 6.0 application because this attribute can be upgraded smoothly.

 

 

Control array

Visual

The basic 6.0 control array is a group of controls that share the same name and type. They also share the same event process. The control array has at least one element. As long as your system resources and memory allow, it can have any number of elements. The elements of the same control array have their own attribute settings.

 

 

 

Visual Basic. net

 

 

The Windows Forms architecture can handle multiple methods of using control arrays. For example, in Windows Forms, you can use a single event handle to process multiple events of multiple controls.

The "control array Windows Forms" extension control in the compatible Library provides this function.

 

 

Menu Control

Visual

The basic 6.0 Menu Control represents each item in the menu tree. The same menu control instance can be used in the main menu or context menu at the same time.

 

 

 

Visual Basic. net

 

 

The menuitem control represents each item in the menu tree. The menuitem control can be added to the mainmenu project or contextmenu project, but cannot be added at the same time. To share menus in mainmenu objects and contextmenu objects, you can use the clonemenu method in menuitem to create menu copies.

 

 

 

Upgrade

Wizard

 

 

Use the context menu code to mark an upgrade error. You can use menuitem. clonemenu to create a copy of The mainmenu project and use it as a contextmenu project.

 

 

OLE container control

Visual

The basic 6.0 OLE container control allows you to add an OLE object to a form.

 

 

 

Visual Basic. net

 

 

Visual Basic. Net does not have an OLE container control. If you need a control equivalent to the OLE container control, you can add the webbrowser control to the form and use it as the OLE container control.

 

 

 

Upgrade

Wizard

 

 

This upgrade error is reported in the upgrade report and placeholders of unsupported controls are placed in the form.

 

 

Image Control

Visual

The basic 6.0 Image and picturebox controls can display bitmap, icons, metafiles, enhanced-type metafiles, JPEG or GIF files.

 

 

 

Visual Basic. net

 

 

The picturebox control in Visual Basic. Net replaces the picturebox and image controls in Visual Basic 6.0. The picturebox control in Windows Forms also supports dynamic GIF files. However, if you need a simple solution to draw an image in a form, you can also use the drawimage method instead of the form onpaint event.

 

 

 

Upgrade

Wizard

 

 

The image control is changed to the picturebox control.

 

 

Line and shape controls

Visual

The basic 6.0 line control displays a horizontal, vertical, or diagonal line. The shape control displays the rectangle, square, elliptical, circular, rounded rectangle, or rounded corner square.

 

 

 

Visual Basic. net

 

 

The GDI + class in system. Drawing replaces the line and shape controls. Do not use the onpaint event to draw images of various shapes in the form. Instead, use the GDI + draw method to draw various shapes, such as circles and squares.

 

 

 

Upgrade

Wizard

 

 

The horizontal and vertical line controls are changed to label controls (no text, height, or width is set to 1 ). The diagonal control reports an upgrade error in the upgrade report and places placeholders of unsupported controls in the form.

 

The rectangle and square shape controls are changed to label controls. Other shape controls report upgrade errors in the upgrade report and place placeholders of unsupported controls in the form.

 

 

Windowless Control

Visual

Basic 6.0 is a lightweight control, sometimes called a window-free control. The most significant difference from a conventional control is that there is no window handle (hwnd attribute ). Therefore, they use less system resources. You can set the windowless attribute to true during design to create a lightweight user control. A lightweight user control can only contain other lightweight user controls. Not all containers Support lightweight controls.

 

 

 

Visual Basic. net

 

 

In Windows Forms, most windowless controls are used in Windows by default. The main advantage of using a windowless control is that when there are a large number of controls in a form, it can reduce resource consumption (window handle ). This is limited to Windows 9X. Microsoft Windows NT? And Microsoft Windows 2000 do not have such resource restrictions.

 

Windows-free controls also have disadvantages (such as la S such as la s), but Microsoft recognizes the role of Windows-free controls and uses release examples to demonstrate how to achieve similar results in Windows Forms.

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.