Conversion from Visual Basic 6.0 to Visual Basic.net
Microsoft Visual Basic.net is a subsequent version of Microsoft Visual Basic ©, which is redesigned based on the .NET framework, you can use it to easily create next-generation applications for Microsoft Windows © operating systems and web. Use Visual Basic.net, visual development web applications, web services, Windows applications, and server-side components. In addition, Visual Basic.NET uses the XCOPY deployment scenario of Windows applications so you don't have to worry about the DLL version problem. With the release of Visual Basic.Net, "DLL Nightmare" will become the past. When designing Visual Basic.Net, we look at the requirements of Visual Basic developers around the world. The Visual Basic language is now true object-oriented language and supports inheritance. The form designer supports visual inheritance and contains new features such as form automatic adjustment, resource localization, and access option. The current data tool continues to support XML data and can use design-time data binding and disconnecting data. In addition, Visual Basic.NET is created directly based on the .NET framework, so you can use all platform features and work with other .NET language. While publishing these features, we have made a modification of several aspects of the product. This document describes some changes from Visual Basic 6.0 to Visual Basic.Net and explains why these changes are explained. This article also introduces the functionality of the Visual Basic.net upgrade wizard. It is a tool provided as part of the product that helps you upgrade an existing application to a Visual Basic.NET version. For additional information on upgrading from Visual Basic 6.0 to Visual Basic.NET, please refer to the White Paper "Prepare to upgrade Visual Basic 6.0 Application to Visual Basic.Net". This white paper introduces the upgrade process and provides constructive advice as possible. Language Variant
Visual Basic 6.0 Variant is a special "universal" data type that can include various types of data other than the constant string. The Object variable is used as a pointer to the object. The default data type is Variant. Visual Basic.NET Public Language Runtime (CLR) uses Object as a general data type. Visual Basic.NET did not continue to use Variant as a general data type, but to choose a CLR naming rule to avoid confusion in cross-language development. Simplify the type system only using a general data type. The default data type is Object. The Upgrade Wizard changes the Variant data type to Object, so the following code: DIM X As Variant upgrade will become: DIM X as Object Integer and long
The Visual Basic 6.0 long variable is stored as a 32-bit number with symbols, and the Integer variable is stored as 16-digit numbers. The Visual Basic.Net long variable is stored as a 64-bit number with symbols, and the Integer variable is stored as a 32-bit number, while the short variable is stored as 16-bit numbers. In a 32-bit system, 32-bit integer operations are faster than 16-bit and 64-bit integers. This means that Integer will be the most effective and basic numeric type. Since some .NET framework technology is based on modern 32-bit and 64-bit technology, it is wise to update the data size according to the new technology. Upgrade the wizard to modify the type of variable, so the following code: DIM X AS INTEGERDIM Y AS Long upgrade will change to: DIM X AS SHORTDIM Y AS INTEGER CURRENCYVISUAL BASIC 6.0 Visual Basic 6.0 supports the Currency data type. You cannot declare the variable as a Decimal type (although variables can have subtype Decimal). The Currency variable is stored as a 64-bit number in an integer format, with a score of 10,000 to represent a fixed point number, and its decimal point is 15 digits, and the right side is 4 bits. This representation can represent the numbers in the range of -922, 337, 203, 685, 477.5808 to 922, 337, 203, 685, 477.5807. The DECIMAL variable is stored as a 96-bit integer with a symbol, a different power of a scale of 10. The 10-powered scale factor specified the number of digits on the right side of the decimal point, its range from 0 to 28. When the index is 0 (no small digits), the maximum possible value is /- 79, 228, 162, 514, 264, 337, 593, 543, 950, 335. When the index is 28, the maximum is /- 7.9228162514264337593543950335, the minimum non-zero value is /- 0.0000000000000000000000000001. The Visual Basic.Net Currency data type is not enough, and it is impossible to avoid a four-round error, so this data type of Decimal is created. The Upgrade Wizard converts the Currency data type to Decimal, so the following code: DIM X AS Currency will become: DIM X as Decimal Date
The Visual Basic 6.0 Date variable is stored inside in Double format, which can be used as a variable operation of the Double type. Date variables are stored as IEEE 64-bit floating point numbers, indicating the date from January 1 to December 31, 9999 and from 0:00:00 to 23:59:59. Any recognizable text date can be specified as a DATE variable. When other numeric types are converted to Date, the values on the left side of the decimal point represent the date information, and the value on the right side of the decimal point indicates time information. At midnight is 0, the noon is 0.5. The entire value is negatively represented by the date before December 30, 1899. Visual Basic.Net Date is stored internally to 64-bit integers, so it cannot be operated directly as Double. The .NET framework provides Tooadate and fromoadate functions to perform conversions between Double and Date. The date is expressed as an integer form to simplify and accelerate the date of the date. The Upgrade Wizard Upgrade tool is not able to detect that all use variables are stored as Double, but it is generally inserted into the appropriate Tooadate or fromoAdate method inserting the Double as Date. For example, the following code: DIM DBL AS DOUBLE DAT AS DATE DBL = DAT upgrade will change to: DIM DBL AS DOUBLE DIM DAT AS DATE DBL = DAT.TooAdate Performance Strings Visual Basic 6.0 Except for the PUBLIC variable of the module Other variables can be declared as a fixed length string. Visual Basic.NET CLR The first version does not support the fixed length string. This support feature will be added in subsequent versions. The Upgrade Wizard does not have problems in most cases. It is assumed that the following code: DIM MyFixedlength After upgrade, the following code will become: DIM MyFixedLengthstring As New VB6.FixedLengthString (100) For full description of this topic, please refer to White Pass "Prepare to place Visual Basic 6.0 Application Upgrade to Visual Basic.Net. Type
The Visual Basic 6.0 Type statement is used to define the data type defined by the user. Visual Basic.Net Type and User-Defined Type will cause confusion because classes, enumerations, and interfaces are also defined by the user. Type and user-defined Type are left from QuickBasic, and the types of users in QuickBasic can define only structures and records. The CLR uses Type this name that contains all data types. Therefore, the Type statement in Visual Basic.NET will become Structure. The Upgrade Wizard changes the TYPE statement to Structure, so the following code: Type MyType MyVariable AS Integer End Type will change to: Structure mytype Dim MyVariable AS SHORT End Structure User Defined Type Storage
Visual Basic 6.0 user-defined data types can include one or more elements of a data type, array, or previously defined user-defined type. In Visual Basic 6.0, they are stored in a continuous memory block. Visual Basic.net format is the most effective. It may be located in a continuous memory or may not. The structure can be marked as a seal processing attribute to ensure that it can be passed to the COM component as a continuous memory block. The Upgrade Wizard is in all positions that need to be added to the seal processing properties, and the API is marked with Todo comments. (Attributes are not automatically added, only they need them when the structure is passed to the API.) Truevisual Basic 6.0 TRUE is -1. Visual Basic.Net True is 1. In view of the synergy of language, there is a need for a consistent representation for all languages. Upgrade Wizard If the Boolean is forced to convert to a non-Boke value, the code will mark the upgrade warning. For example, the following code: Dim MyBoolean As BooleanDim MyInteger As Integer MyInteger = myBoolean after upgrade becomes: Dim MyBoolean As BooleanDim MyInteger As Short 'UPGRADE_WARNING: Boolean MyBoolean is being converted into a numeric MyInteger = MyBoolean Empty
Visual Basic 6.0 variables are initialized to EMPTY. When used for numeric expressions, the variables will automatically convert to zero. When used for string expressions, automatically convert to an empty string. Visual Basic.NET object variables are initialized to Nothing. When used for numeric expressions, the variable will automatically convert to zero. When used for string expressions, it will be automatically converted to an empty string. Use Nothing instead of special EMPTY values to reduce the complexity of the language, and language coordination is more operative. Upgrade Wizard NULL and NULL
The Visual Basic 6.0 NULL value is a subtype of Variant, indicating that the variable does not contain valid data. NULL values are "propagated" through expressions and functions. If either part of the expression is NULL, the entire expression is NULL. These functions will also return NULL when NULL is passed to most functions. Visual Basic.net does not support NULL propagation. A model for programming data using ADO.NET is used to check if the value of the field is NULL before the value of the search field. Variables containing NULL will be encapsulated as a DBNULL type object to the CLR. Visual Basic.net handles NULL more direct: string function (such as left ()) always returns a string and is the same as your expectation. Upgrade The NULL value and the ISNULL function are marked with an upgrade warning comment. For example, the following code: if x is null the msgbox "NULL" upgrade will change to: 'upgrade_warning: use of isnull () detected if isdbnull (x) Then msgbox "null" def
Visual Basic 6.0 Defbool, Defbyte, Defint, DEFLNG, DEFCUR, DEFSNG, DEFDBL, DEFDEC, DEFDATE, DEFSTR, DEFOBJ, and DEFVAR statements are used to set variables, parameters, and process returns (starting with specified characters) at the default data type of the module level set variable, parameter, and process return type . Visual Basic.NET avoids the use of implicit type declarations to improve the readability and reliability of the code. The Upgrade Wizard inserts an explicit statement of the variable type into the code. For example, the following code: Defstr A-ZSUB MYSUB
s = "hello"
End subsets will become: SUB MYSUB
DIM S As String
s = "hello"
Local variables in the END SUB block
Visual Basic 6.0 can be seen from the range of rows containing declarations to the end of the process. Visual Basic.net Visual Basic.NET supports the block range of the variable. This means that from the row containing the declaration, the local variables are visible to the end of the declared block. For example: SUB Test (X as integer)
IF x <0 THEN
DIM Y as integer = - x
'...
Else
'...
END IF
The variable y in the END SUB is available only in the block that declares the variable; more specifically, it is only available between its declaration to the ELSE statement. This variable must be declared outside the IF / ELSE / END IF control structure if you need to use variables throughout the process. The block range of the variable is the function of many structural languages. Process local variables allow definition of internal variables to provide support for structural programming, similar to this, block level variables allow the internal variables of the code block to provide support for structured decomposition. Upgrade Wizard If the variable declares in the block, the variable will be automatically moved to the module level. For example, the following code: IF x = 1 THEN
DIM Y AS Integer
The END IF upgrade will become: DIM Y AS Integer
IF x = 1 THEN
END IF new automatic re-institution
Visual Basic 6.0 Form Class Variable Declaration DIM X AS New
'...
Call x.mymethod () is equivalent: DIM X as myclass
'...
IF x is nothing then
Set x = new myclass
END IF
Call X.Mymethod () Even if the variable has been set to Nothing, the variable will still be re-instantiated when the next call is called. Visual Basic.Net Forms Variable Declaration DIM X AS NEW
X = New myclass object end
Visual Basic 6.0 COM Reference Count Mechanism is used for discrend. If the object is not in the loop, the reference count will immediately detect this situation when the object is no longer used, and the end code is run. Visual Basic.NET Tracking Garbage Equipment From Starting with Stack Variables, Module Variables, and Shared Variables, the object will be over again. This tracking process runs as a background task, so there is an uncertain time period between the last reference end of the object to the object, and add a new reference. In some cases, the client does need to force an object to release resources. The CLR specifies that such an object should implement the IDisposable interface, which provides the Dispose method. When the client ends the use of an object with the Dispose method, it can explicitly call the Dispose method to release its resources. For example, the object of the packaging database connection should disclose the Dispose method. Tracking garbage collectors can correctly release objects in the reference loop. In addition, tracking garbage collectors should be much better than reference counts. Upgrade Wizard In most cases, this change will not cause problems. If your code is opened (connected or file handle), this handle must be explicitly closed. This problem is easy to detect and cause an error in runtime. Array
The Visual Basic 6.0 array can be limited by the upper and lower limits of any integer number. If the lower limit is not specified in the statement, the default lower limit will be determined using the OPTION BASE statement. Visual Basic.net In order to work with other languages, the lower limit of all arrays must be zero. This will no longer need an OPTION BASE statement. Upgrade wizard Redim
The fixed size array in Visual Basic 6.0 Visual Basic 6.0 is different from the unproductive size array. The fixed size array is declared by a DIM statement, including the array boundaries in this declaration. Dynamic arrays declared in a DIM statement, not specifying limitations. Before using the dynamic array, you need to re-mark the dynamic array through the Redim statement. In Visual Basic 6.0, the RedIM statement provides a shortcut method for dynamic array declarations and allocation spaces in a single statement. The RedIM statement is the only statement that can be declared and initialized in Visual Basic 6.0. The Visual Basic.Net RedIM statement is only used to assign or reassign space for array, and cannot be used to reassign an array. This is because all arrands in Visual Basic.NET are dynamic, and the DIM statement in Visual Basic.NET can be used to declare dynamic arrays and can be used to initialize dynamic arrays. Since all variable declarations can declare variables and specify the initial value of the variable, use Redim to declare and initialize the variables to become extra and unnecessary. Just need a DIM statement declaration variable makes the language easier and consistency higher. Upgrade Wizard If redim () is used to declare an array, the corresponding declaration is automatically inserted in the code. However, the best way is to insert a DIM statement in an array, because the REDIM declaration array requires an upgrade tool to infer the correct statement. Codes that are inconvenient to handle using RedIM, because the arrays are in the same statement in both. Assignment Visual Basic 6.0 assignment forms: Let assignment (default) and set assignment. Use the SET statement to assign a value. Visual Basic.NET has only one assignment form. X = y means assigns a value of the variable or attribute Y to the variable or attribute x. The value of the object type variable is a reference to the object instance, so if x and y are the variable of the reference type, the reference is assigned. This single-form assignment reduces the complexity of the language and makes the code readability more readable. The Upgrade Wizard deletes the set and let statement. Parlect the default properties of the strong type object and explicitly add the property to the code. For a comprehensive description of this topic, please refer to the White Paper "to upgrade the Visual Basic 6.0 application to Visual Basic.Net". And, OR, XOR and NOT
Visual Basic 6.0 and NOT operators can perform logical operations or bit operations (depending on expressions). Visual Basic.Net and, OR and XOR are only available for Boolean. For the AND and OR operators, if the value of the first arithmer is sufficient to determine the result of the operator, the operator simplifies the calculation. The new operator Bitor, Bitand and Bitxor are used for bit logical operations. The BITXXX operator does not have a simplified role. Upgrade Wizard If the AND / OR statement is a non-Boo-type or contains functions, methods or properties, this statement will be upgraded to use the compatibility function, which is the same as the expression in Visual Basic 6.0. If the and / or state is a Boolean, this statement will be upgraded to using a local Visual Basic.NET statement. For a comprehensive description of this topic, please refer to the White Paper "to upgrade the Visual Basic 6.0 application to Visual Basic.Net". Operator priority
The priority of the Visual Basic 6.0 logic and bit of the AND, OR, XOR, and NOT operators are higher than the comparative operator. The priority of Visual Basic.Net and, OR, XOR and NOT operators is lower than comparison operators, so A> B and A
Visual Basic 6.0 can declare the process via Static keyword, which indicates a local variable of the process between the call. Visual Basic.net does not support static keywords during the process, and all static partial variables need to explicitly declare through the Static statement. There is a small case where all variables in the process are required to be static. Deleting this feature simplifies the language and enhances readability, because local variables are always in the stack unless explicitly declared as static. The Upgrade Wizard If the process is marked as static, all local variables become static. Parameter Byval / Byref Default
Visual Basic 6.0 parameter does not specify its default value to BYVAL or BYREF, its default value is byref. Visual Basic.net Visual Basic 6.0 The optional Variant parameter without the default value will be initialized to a special error code, which can be detected by the ismissing function. Visual Basic.net requires all optional parameters in Visual Basic.NET to specify the default value. This reduces the number of special values in the language to simplify the language. The Upgrade Wizard ismissing function is replaced by the ISNothing function and tagging has an upgrade warning comment. ParamarRay Parameters Visual Basic 6.0 You can modify the modified function when the variable is passed to the ParamarRay parameter. Byval paramarray elements are not supported. Visual Basic.NET cannot be modified by the called function when the variable is passed to the Paramarray parameter. Byref paramarray elements are not supported. The most common case of ParamarRay parameters is that the variable passing to this parameter is passed. The BYREF Paramarray parameter simplifies Paramarray call rules because the ParamarRay parameter is specified as a normal array. In this way, the ParamarRay parameter can be extended to any element type, and the function of the ParamarRay parameter can be directly called by an array (not the parameter list). The Paramarray parameter tag of the upgrade wizard is a upgrade warning. For example, the following code: Function myfunction (paramarray p () as variant '... End function will be changed to: 'upgrade_warning: paramarray P Was Changed from byref to ByVal Function myfunction (Byval Paramarray P () as Object) '... AS ANY parameters in the end function declaration Visual Basic 6.0 Local API parameters can be declared as ANY, which can pass any data type for the call to the local API. Through this method, the parameters can be called to support the APIs of two or more data types. Visual Basic.NET overloaded Declare statements can be defined as allowed to call with two or more local APIs with two or more data types. For example, the following declare statement: private declare function getprivateprofilestring_DextProfileString_ LIB "kernel32" alias "getprivateprofilestringa" (_ _ Byval lpapplicationname as string, _ Byval lpkeyname as any, _ Byval lpdefault as string, _ Byval lpreturnedstring as string, _ Byval nsize as long, _ Byval LPFileName As String) As long can be replaced by two Declare versions, one accepts long, one accepts strings. Overloads Private Declare Function GetPrivateProfileStringKey_ LIB "kernel32" alias "getprivateprofilestringa" (_ _ Byval lpapplicationname as string, _ Byval lpkeyname as string, _ Byval lpdefault as string, _ Byval lpreturnedstring as string, _ Byval nsize as long, _byval lpfilename as string) As long Overloads Private Declare Function GetPrivateProfileStringnullKey_ LIB "kernel32" alias "getprivateprofilestringa" (_ _ Byval lpapplicationname as string, _ Byval lpkeyname as long, _ Byval lpdefault as string, _ Byval lpreturnedstring as string, _ Byval nsize as long, _ Byval LPFileName As String) As long increases type of security and reduces minikogenesis that leads to the failure. The presence of this is because the compiler does not allow the API to be called by a data type without explicitly defined. The Upgrade Wizard uses the declare statement of the AS Any parameter to mark an upgrade warning. IMPLEMENTS The Visual Basic 6.0 IMPLEMENTS statement specifies the interface or class implemented in the class module that appears. There are two essential differences between IMPLEments in Visual Basic.Net Visual Basic.NET with Visual Basic 6.0: Categories cannot be specified in the Implements statement. Each implementation method requires the use of the Implements clause at the end of the method declaration statement. This clause specifies the interface method thereof. Since each implementation interface method is required to use the Implements clause, the readability of the code is improved; this advantage is obvious when reading the code of the interface method. Upgrade Wizard If class A implements class B, the interface will be declared for class B, and class A will become an interface to implement class B: Interface_B Function myfunction () AS STRING End interface Class A Implements_b Function B_myfunction () AS STRING IMPLEments_B.MYFUNCTION END FUNCTION End class attribute Visual Basic 6.0 In Visual Basic 6.0, the GET, LET, and SET attribute functions of a particular property can be declared through different levels of access options. For example, the Property GET function can declare that the Property LET can be declared as Friend. The GET and SET functions of the Visual Basic.Net property must have the same level of access options. This makes it easy for Visual Basic.NET to work with other .NET language. Upgrade Wizard If the level of access options, the new property is public. Default attribute Visual Basic 6.0 Any member can be marked as a default value. Visual Basic.NET can only be marked as default value if the property accepts the parameters. This situation is common for a parameter attribute that will become an index in a collection. This makes the code more readable because references to object variables without members are usually pointing to the object itself, rather than pointing to the objects in the context and other contexts. For example, statement call display (textbox1) may be passed to the Display function, or the content that passes the text box. In addition, deleting this unssemblance avoids execution of reference assignments using a separate statement. Assignment x = Y always means assigning the contents of the variable Y to the variable X instead of assigning the default attribute of the object to the Y-reference to the default properties of the object to the object. The Upgrade Wizard parses the default properties as much as possible. Error comments will be added (delayed binding object) when you cannot parse. Enumeration Visual Basic 6.0 enumerations can be referenced without limitation. Visual Basic.NET If you add IMPORT to an enumeration in the file or project level, the enumeration can be unlimited. This can be consistent with the class, structure, and interfaces. In class, structures, and interfaces, they can give members to give universal names without having to worry about conflicts with other members. For example, the Color enumeration and Fruit enumeration can include a constant named ORANGE. The rule in Visual Basic 6.0 is that the prefix is prefixed to keep each constant unique for the enumeration. This makes the constant names are very cumbersome, such as MscoloroRoRe, and MSFRUITORANGE. The upgrade wizard will become fully qualified. While The Visual Basic 6.0 While The statement ends with the Wend statement. Visual Basic.NET is consistent with its block structure, and the end statement of the While is end while. This improves the consistency and readability of the language. The Upgrade Wizard changes the Wend statement to end while. ON ... GOTO and ON ... GOSUB Visual Basic 6.0 The ON Expression Goto DestinationList statement changes one of the specified rows in the target list based on the value of the expression, the ON Expression Goto DestinationList statement. Visual Basic.Net ... goto and on ... Gosub are unstructured programming constructs. Their use makes the program more difficult to read and understand. SELECT CASE provides a more structured and flexible way to perform multiple branches. Note: Still supports on Error Goto. Upgrade Wizard The following example: On MyVariable Goto 100, 200, 300 will be marked with upgrade error: 'Upgrade_issue on MyVariable Goto Was Not Upgraded On Myvariable Goto 100, 200, 300 You should rewrite the code to avoid using this statement, for example: on x goto 100, 200, 300 can be rewritten as: SELECT CASE X Case 1: 'Insert the code of the 100th line Case 2: 'Insert the 2000 line code Case 3: 'Insert the code 300 line End Select Gosub ... Return Visual Basic 6.0 Gosub Line ... return statement branches into subroutines during the process and then returns from subroutines. Visual Basic.Net Gosub ... Return is a non-structured programming structure. Its usage makes the program more difficult to read and understand. A more structured alternative is: Creating an independent process that can be called. The Upgrade Wizard is the same as on ... goto, and these statements are marked with upgrade errors. Lset Visual Basic 6.0 LSET filled with a space to make it specified length, or copy the variable of the user-defined type to another user-defined type. Visual Basic.net does not support LSET statements. LSET is unsafe to the type, so errors are caused at runtime. In addition, since it is unsafe to the type, the execution time code must be completely reliable. After deleting the LSET statement, you cannot copy a structure to another; however, you can modify the Visual Basic.NET code, use RTLCopyMemory to obtain the same effect. Upgrade wizard statement: Lset A1 = A2 will be marked with upgrade error 'upgrade_issue: lset cannot Assign A Udt from One Type to Another LSET A1 = A2 Varptr, Strptr and Objptr Visual Basic 6.0 Varptr, StrPtr, and Objptr Returns the address of the variable in an integer, and then pass this address to the API function (for example, RTLCopyMemory) using the address. Varptr Returns the address of the variable, StrPtr Returns the address of the string, Objptr Returns the address of the object. These functions are not recorded in the document. Visual Basic.net can retrieve the address of the data item, but the retrieval must be done by calling the CLR. This is because the CLR can usually be free to move in memory, so it is necessary to let the CLR know when using the address and cannot move the project. The address of the object retrieves the address of the object: DIM MyGchandle As gchandle = gchandle.alloc (o, gchandletype.pinned) DIM address as integer = cint (mygchandle.addrofpinnedObject ()) '... MyGchandle.Free () 'Allows the mobile object instance to allow the running data project to improve the performance of the runtime. Upgrade wizard These statements do not automatically upgrade, so the upgrade error with "Statement is not supported" [statement is not supported]. For example, the following code: a = varptr (b) After the upgrade is: 'Upgrade_issue: function varptr () is not supported A = varptr (b) This will also cause compilation errors. File I / O Visual Basic 6.0 language includes file I / O statements. Visual Basic.net uses file I / O operations through class libraries. Remove file I / O statements from languages to use different I / O libraries in Visual Basic.net. If the file I / O statement exists in the language, the code will be more cumbersome, the identifier Open, Close, Print, and Write will become a reserved word. The Upgrade Wizard file I / O statement will be 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 Immediate 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, and there is no newline. Upgrade Wizard Debug.print Upgrade to Debug.WriteLine. resource Visual Basic 6.0 Visual Basic 6.0 supports each project using a .res file. Visual Basic.net Visual Basic.net supports multiple resource files. You can bind the form to automatically retrieve resources from the new .resx format resource file. Any CLR class can be stored in the .resx file. The upgrade wizard file is upgraded to .resx, and the code is modified to load it from the .resx file. Windows Applications Visual Basic Form Visual Basic 6.0 Visual Basic 6.0 has its own form package for creating a graphics Windows application. Visual Basic.Net For Visual Basic.net, the Windows Form is a new form package. Since the Windows Form is constructed in a public language runtime (CLR), the Windows Form can take full advantage of all of the CLR. In particular, since the Windows Form Pack has the advantage of deployment, application separation, version, and code access security features, you can now construct a Windows-based client application, and its deployment and update is more simple easier. You can even construct a Windows Form Application with HTML's deployment scenario. As the granular control of the code access security, these features also make it very remarkable in your browser. The Windows Form Sets to Visual Basic developers with many new features, such as visual inheritance, improved localization and access support, automatically adjust the form size and place menu editor. The Upgrade Wizard upgrades the Visual Basic form to a Windows Form. PRINTFORM method The Visual Basic 6.0 PrintForm method sends an image of the FORM object to a byte by one byte to the printer. However, this printing function cannot work normally in some forms. Visual Basic.NET In a Windows Form, the print frame in Visual Basic.NET allows you to quickly generate complex print documents. It also includes a built-in "Print Preview" dialog. Upgrade Wizard PrintForm method call tag has an upgrade error. You can create a print document using the new print frame, and even take the screen snapshot of the application window and print. Circle, CLS, PSET, LINE and POINT Method Visual Basic 6.0 With Circle, CLS, PSET, LINE, and POINT methods, you can draw in the form or clear these images. The Visual Basic.Net Windows Form has a new set of graphics commands for replacing Circle, CLS, Pset, Line, and Point. The Windows Form Bag is built on the GDI basis. GDI is a rich two-dimensional text and image processing graphics library, and now you can use it directly in Visual Basic.NET. In previous versions, if you don't pass the Declare statement and the GDI API, Visual Basic programmers cannot use these features. Although this transition is relatively large, GDI flexibility and powerful functions allow programmers to quickly develop applications, while using previous versions of Visual Basic will cost more workload. The Upgrade Wizard has an upgrade error to the call marks of these methods. You can write down the graphic calls using the GDI class in System.drawing. Name attribute Visual Basic 6.0 Name Properties Returns the name used in the code to identify forms, controls, or data access objects. Read only when running. Visual Basic.net does not support the Name properties of the Forms and controls when the Windows Form is run. If you need an iterative controls collection to find a certain name, you can use the .NET framework's System.Reflection class to find. The NAME attribute of the upgrade wizard control will mark an upgrade error. Caption property Visual Basic 6.0 Some controls (such as label) have a Caption property that is used to determine text displayed next to the control or next to the control. Other controls (such as TextBox) have a TEXT property that determines the text contained in the control. Visual Basic.net In a Windows Form, for all controls, the properties of the text in the controls are uniformly referred to as Text. This simplifies the use of controls. The Upgrade Wizard converts the Caption property of the control to Text. Tag attribute The Visual Basic 6.0 Tag property can return or set an expression for the additional data required for the storage program. The tag attribute is required in Visual Basic 6.0. Visual Basic.net In a Windows Form, you can use inheritance to extend the built-in control and add your own properties. Use the inheritance as a tool to make the built-in control more flexible. Not only can you add any variety of properties as needed, but you can set these properties to strong properties. The Windows Form Extension TAG control in the Upgrade Wizard is used to provide the same features. ScaleMode property The Visual Basic 6.0 scalemode property returns or sets a value to indicate the coordinate metrics of the object when using a graphical method or positioning control. Visual Basic.Net Windows Forms always use pixels as a unit of measure, simplifying form layout. In addition, Windows Forms use a better way to resize. The AutoScaleBaseSize property automatically adjusts the zoom ratio according to the resolution of the screen (DPI) and the font size used. Upgrade Wizard Use the code of "TWIP" (the default settings in Visual Basic 6.0) will be fully upgraded. If scalemode is not 缇, you will encounter problems in the adjustment. For a comprehensive description of this topic, please refer to the White Paper "to upgrade the Visual Basic 6.0 application to Visual Basic.Net". Font Visual Basic 6.0 Forms and controls can use any Windows fonts. Visual Basic.net Forms and controls can only use TrueType or OpenType fonts. Fonts using these types can solve many inconsistency problems between different operating system versions and their localized versions. These fonts also have functions that do not rely on device resolution and reverse. Upgrade Wizard If you use non-TrueType fonts in your application, these fonts will become a default Windows form font, but its format (size, bold, bodies, and underscore) will be lost. Screen.MousePointer attribute The MousePointer property of the Visual Basic 6.0 Screen object can return or set a value to indicate that the mouse pointer type displayed outside the application form is displayed. Visual Basic.net If the mouse pointer is in the form within the application, you can operate; if it is located outside the application, it is not possible. In the future version, we will continue to improve their functions. Upgrade Wizard Use the Sceen.MousePointer's statement to marke an upgrade error. Timer.Interval property The Interval property of the Visual Basic 6.0 Timer Control returns or sets the number of milliseconds between Timer event calls. If set to 0, disable the Timer control. The enabled property is also used to determine if the timer is running. This will cause confusion because even if the enabled attribute is TRUE, if the time interval is 0, the timer cannot be enabled. The Visual Basic.Net Interval property indicates the time (in milliseconds) between the timer scale. This property cannot be set to 0. The enabled property specifies whether the timer is running. This approach is more direct and simplifies the encoding of the Timer object. Upgrade Wizard If Timer.Interval is set to 0, the Upgrade Wizard can detect this situation and upgrade an error for the Timer.InterVal tag. It is recommended that you use Timer.Enabled in the Visual Basic 6.0 application because this property can be upgraded smoothly. Control array Visual Basic 6.0 control array is a set of controls that share the same name and type. They also share the same event process. There is at least one element in an array of control, as long as your system resources and memory allow, it can have any multiple elements. The elements of the same control array have their own attribute settings. The Visual Basic.Net Windows Form architecture can handle multiple solutions using the control array. For example, multiple events of multiple controls can be processed through a single event handle in a Windows Form. The Control Array Windows Forms in the Upgrade Wizard Board provides this feature. Menu control Visual Basic 6.0 MENU control represents various items in the menu tree. The same MENU control instance can be used in the main menu or context menu. The Visual Basic.Net MenuItem control represents the various items in the menu tree. The MenuItem control can be added to the MainMenu item or the ContextMenu project, but cannot be added at the same time. To share menus in the MainMenu object and ContextMenu object, you can create a menu copy using the CloneMenu method in Menuitem. The Upgrade Wizard uses the code for the context menu to upgrade an upgrade error. You can use MenuItem.cloneMenu to create a copy of the MainMenu project, used as a ContextMenu project. OLE container control Visual Basic 6.0 OLE container control allows you to add OLE objects to your form. There is no OLE container control in Visual Basic.Net Visual Basic.net. If you need a control with the OLE container control, you can add the webbrowser control to the form and use it as the OLE container control. The Upgrade Wizard reports this upgrade error in the upgrade report and place the placeholder that is not supported by the support control in the form. Image control Visual Basic 6.0 Image and PictureBox controls can display graphics, icons, chair files, enhanced meta files, JPEG, or GIF files. The PictureBox control in Visual Basic.net Visual Basic.NET replaces the Picturebox and Image controls in Visual Basic 6.0. The Picturebox control in the Windows Form also supports dynamic GIF files. However, if you need a simple solution to draw an image in the form, you can also use the DrawImage method without using the form's onpaint event. The Upgrade Wizard Image control becomes a PictureBox control. LINE and Shape controls Visual Basic 6.0 Line control displays horizontal lines, vertical lines, or diagonal lines. The Shape control displays a rectangle, a square, an ellipse, a circular, rounded rectangle or rounded square. The GDI class in Visual Basic.Net System.drawing replaces the Line and Shape controls. To draw a graphic of various shapes in the form, do not use the onpaint event, and use the GDI DRAW method to draw rounds, squares and more. The upgrade wizard level and vertical LINE control becomes the Label control (no text, height, or width is set to 1). The diagonal control reports an upgrade error in the upgrade report and places a placeholder that is not supported in the form. The rectangle and the square shape control becomes the Label control. Other Shape Controls are reported to have an upgrade error in the upgrade report and place a placeholder that is not supported by the support control in the form. Windowless control Visual Basic 6.0 lightweight control, sometimes called a windowless control, with the most significant difference from regular controls: no window handle (HWnd property). Therefore, they use less system resources. You can set the Windowless property to TRUE when designing to create a light user control. Lightly user controls can only contain other lightweight user controls. Not all containers support lightweight controls. Visual Basic.net In a Windows Form, most windowless controls are used by default in the window. The main advantage of using a windowless control is that the resource consumption (window handle) can be reduced when there is a very large number of controls in the form. This is limited to Windows 9x. Microsoft Windows NT® and Microsoft Windows 2000 do not have such resource restrictions. With a windowless control, there are shortcomings (such as layering issues such as layering, but Microsoft recognizes the role of windowless controls and will release examples to demonstrate how similar results are available in Windows Forms. The Upgrade Wizard does not require special processing. CLIPBOARD The Visual Basic 6.0 Clipboard object provides access to the system clipboard. The Visual Basic.Net Clipboard class provides a method of placing data and retrieving data from it on a system clipboard. The new CLIPBoard class provides more features and supported clipboard formats more than Visual Basic 6.0 Clipboard objects. The object module has been rebuilt to support these features. Upgrade Wizard Due to the difference between the object module, the existing clipboard code cannot be upgraded automatically. The clipboard statement will mark an upgrade error. Dynamic data exchange Visual Basic 6.0 Some controls have the properties and methods that support Dynamic Data Exchange (DDE) sessions. The Visual Basic.Net Windows form does not support built-in DDE. Upgrade Wizard DDE Properties and Method Tagging has an upgrade warning. Web application WebClass Visual Basic 6.0 WebClass is a Visual Basic component residing on a web server that can respond to the input of your browser. WebClass usually includes WebItems for providing content for your browser and open events. The Visual Basic.Net Web Form has a .NET framework capabilities that can be used to create a browser-based user interface for a web application. Visual Basic.NET has a designer that "WYSIWY", you can create a graphics web form using controls in the toolbox. This way, web user interface development has the same form of Windows development. In addition, after the project is created, the Internet Information Services (IIS) server does not have to stop and restart, you can start deploying new content, and you cannot use WebClass. Upgrade Wizard WebClass will be upgraded to a web form. All status storage calls are marked with an upgrade warning. You can rewrite these codes to use the advantages of ASP.NET status management. You can also choose to continue using WebClass applications in Visual Basic 6.0, location from Visual Basic.NET Web Forms to WebClass and WebForm, and so on. ActiveX Documents and DHTML Applications Visual Basic 6.0 ActiveX® documents are displayed in the Internet browser window and provide built-in view scrolling, hyperlinks, and menu negotiations. The DHTML application contains DHTML pages and client ActiveX DLLs. The Visual Basic.NET Web Form is adopted by HTML to support a variety of applications. It can support multiple applications in a safer manner by using the Windows Form Controls stored in the browser or the downloaded "secure Windows Form" EXE. This code is run in a security sandbox, so it does not cause damage to the user's computer. Upgrade Wizard Although ActiveX documents and DHTML applications cannot be upgraded directly, you can still switch between ActiveX documents, DHTML applications, and web forms. Data ADO, RDO and DAO code Visual Basic 6.0 ActiveX® Data Objects (ADO), Remote Data Objects (RDO), and Data Access Objects (DAO) are used to connect and disconnect data access. Visual Basic.Net ADO.NET provides additional classes that disconnect data access. These classes provide better performance and scalability than earlier versions of ADO for distributed applications. They also make the integration of XML data to database data more simple. ADO, RDO, and DAO can still be used in the Upgrade Visual Basic.Net code. ADO, RDO and DAO data binding The control in the Visual Basic 6.0 Visual Basic Form can be bound to the ActiveX® Data Object (ADO), Remote Data Object (RDO), and Data Access Object (DAO) data source. Visual Basic.Net ADO.NET provides a read / write data binding for the Windows Form Control, providing a read-only data binding for the web form. Upgrade Wizard ADO data binding is upgraded to new ADO.NET data binding. However, RDO and DAO data binding cannot be upgraded, and will report an upgrade error in the upgrade report. IDE "Immediate" window Visual Basic 6.0 In the "Immediate" window of the design mode, you can run some code without having to start the entire application through its Startup object. For example, a form, calling module process, and interaction with global variables can be displayed. This is because Visual Basic 6.0 is run from the code's memory image, not the created output used by the debug runtime. Visual Basic.net can execute the IDE command from the "Command" window of the design mode, but cannot run the applications. This is because the operation of Visual Basic.NET and commissioning is the actual output of the runtime. This form of debugging is the most accurate reproduction of running. IDE and project extensibility Visual Basic 6.0 only Visual Basic 6.0 support Visual Basic 6.0 integrated development environment (IDE) extension model. Visual Basic.net For all engineering types in Visual Studio.NET, the new IDE extension model is common. This makes it easier to create an external program that works with a variety of different types of projects. The Visual Basic Engineering System extension model can also be shared with C #, so the specific functions of the project (such as adding references or change engineering properties) are the same in both languages. The Visual Studio.NET code model also provides a public object model to the expansion-level writer to write code across different language projects. Visual Basic supports reading code through the code model. To write a code, you can remove an insert point from the model, then write to Visual Basic syntax