




版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Preparing Your Visual Basic 6.0 Applications for the Upgrade to Visual Basic .NETOverviewThis document provides recommendations for developers using Microsoft® Visual Basic® who are planning to upgrade their applications to Microsoft Visual Basic .NET.Visual Basic .NET will open and upgrad
2、e Visual Basic 6.0 projects to Visual Basic .NET technologies, but in most cases you will need to make some modifications to your projects after bringing them into Visual Basic .NET. The purpose of this document is to recommend how to design and implement your current Visual Basic projects to minimi
3、ze the number of changes you will need to make when they are upgraded to Visual Basic .NET. Where appropriate, we use new language constructs; however, this document is not intended to be a Visual Basic .NET language reference. What Is Visual Basic .NET?Visual Basic .NET is the next version of Visua
4、l Basic. Rather than simply adding some new features to Visual Basic 6.0, Microsoft has reengineered the product to make it easier than ever before to write distributed applications such as Web and enterprise n-tier systems. Visual Basic .NET has two new forms packages (Windows Forms and Web Forms);
5、 a new version of ADO for accessing disconnected data sources; and streamlined language, removing legacy keywords, improving type safety, and exposing low-level constructs that advanced developers require.These new features open new doors for the Visual Basic developer: With Web Forms and ADO .NET,
6、you can now rapidly develop scalable Web sites; with inheritance, the language now truly supports object-oriented programming; Windows Forms natively supports accessibility and visual inheritance; and deploying your applications is now as simple as copying your executables and components from direct
7、ory to directory.Visual Basic .NET is now fully integrated with the other Microsoft Visual Studio .NET languages. Not only can you develop application components in different programming languages, your classes can now inherit from classes written in other languages using cross-language inheritance.
8、 With the unified debugger, you can now debug multiple language applications, irrespective of whether they are running locally or on remote computers. Finally, whatever language you use, the Microsoft .NET Framework provides a rich set of APIs for Microsoft Windows® and the Internet.Why Is Visu
9、al Basic .NET Not 100% Compatible?There were two options to consider when designing Visual Basic .NETretrofit the existing code base to run on top of the .NET Framework, or build from the ground up, taking full advantage of the platform. To deliver the features most requested by customers (for examp
10、le, inheritance, threading), to provide full and uninhibited access to the platform, and to ensure that Visual Basic moves forward into the next generation of Web applications, the right decision was to build from the ground up on the new platform.For example, many of the new features found in Windo
11、ws Forms could have been added to the existing code base as new controls or more properties. However, this would have been at the cost of all the other great features inherent to Windows Forms, such as security and visual inheritance.One of our major goals was to ensure Visual Basic code could fully
12、 interoperate with code written in other languages, such as Microsoft Visual C# or Microsoft Visual C+®, and enable the Visual Basic developer to harness the power of the .NET Framework simply, without resorting to the programming workarounds traditionally required to make Windows APIs work. Vi
13、sual Basic now has the same variable types, arrays, user-defined types, classes, and interfaces as Visual C+ and any other language that targets the Common Language Runtime; however, we had to remove some features, such as fixed-length strings and non-zero based arrays from the language.Visual Basic
14、 is now a true object-oriented language; some unintuitive and inconsistent features like GoSub/Return and DefInt have been removed from the language.The result is a re-energized Visual Basic, which will continue to be the most productive tool for creating Windows-based applications, and is now posit
15、ioned to be the best tool for creating the next generation Web sites. Upgrading to Visual Basic .NET Visual Basic .NET enables a fundamental shift from traditional Windows development to building next-generation Web and n-tier applications. For this reason, your code will need to be upgraded to take
16、 advantage of Visual Basic .NET. This happens automatically when you open a Visual Basic 6.0 project in Visual Basic .NET: the Upgrade Wizard steps you through the upgrade process and creates a new Visual Basic .NET project (your existing project is left unchanged). This is a one-way process; the ne
17、w Visual Basic .NET project cannot be opened in Visual Basic 6.0. When your project is upgraded, the language is modified for any syntax changes and your Visual Basic 6.0 Forms are converted to Windows Forms. In most cases, you will have to make some changes to your code after it is upgraded. This i
18、s required because certain objects and language features either have no equivalent in Visual Basic .NET, or have an equivalent too dissimilar for an automatic upgrade. After the upgrade, you may also want to change your application to take advantage of some of the new features in Visual Basic .NET.W
19、orking with Both Visual Basic 6.0 and Visual Basic .NETVisual Basic .NET supports upgrading Visual Basic 6.0 projects; if you have a project written in Visual Basic versions 1 to 5, we recommend you load it into VB6 (choosing to upgrade Microsoft ActiveX® controls), compile, and save the projec
20、t before upgrading it to Visual Basic .NET. Both Visual Basic .NET and Visual Basic 6.0 can be installed on the same computer and run at the same time. Likewise, applications written in Visual Basic .NET and Visual Basic 6.0 can be installed and executed on the same computer. Components written in V
21、isual Basic .NET can interoperate with COM components written in earlier versions of Visual Basic and other languages. For example, you can drop an ActiveX control written in Visual Basic 6.0 onto a Visual Basic .NET Windows Form, use a Visual Basic 6.0 COM object from a Visual Basic .NET class libr
22、ary, or add a reference to a Visual Basic .NET library to a Visual Basic 6.0 executable.Components compiled with Visual Basic .NET have subtle run-time differences from components compiled with Visual Basic 6.0. For starters, because Visual Basic .NET objects are released through garbage collection,
23、 when objects are explicitly destroyed, there may be a lag before they are actually removed from memory. There are additional differences such as the variant/object changes described later in this document. The combined result of these differences is that Visual Basic .NET applications will have sim
24、ilar but not identical run-time behavior to Visual Basic 6.0 applications.In addition, Visual Basic .NET makes binary compatibility between Visual Basic .NET components and those in Visual Basic 6.0 unnecessary. Components now have a more robust versioning and deployment system than ever before, fil
25、es can be deployed by simply copying to a directory (no more RegSvr32), and upgrading to a new version of a component is as simple as replacing the old file with a new file. All you have to do is ensure classes and methods are compatible with the previous version.Architecture RecommendationsThe .NET
26、 platform improves upon previous architectures, and adds greater support for scalability and distributed applications though disconnected data access, HTTP-based message transport, and file-copy based deployment (no more registering of components). To best take advantage of these features, you shoul
27、d design your applications with an architecture similar to that you would use in Visual Basic .NET.Browser-based ApplicationsVisual Basic 6.0 and Microsoft Visual Studio® 6.0 offered several technologies for creating browser-based Internet and intranet applications: · Webclasses · DHT
28、ML projects · ActiveX documents · Active Server Pages (ASP) Visual Basic .NET introduces ASP.NET, an enhanced version of ASP, and adds to the architecture with Web Forms, which are HTML pages with Visual Basic events. The architecture is server-based. Below is a list of recommendations and
29、 architectural suggestions for developing Visual Basic 6.0 browser-based applications that will most seamlessly migrate to Visual Basic .NET projects: · We recommend you use the Microsoft multi-tier architecture guidelines to create your applications, create the interface with ASP, and use Visu
30、al Basic 6.0 or Visual C+ 6.0 COM objects for your business logic. ASP is fully supported in Visual Basic .NET, and you can continue to extend your application using ASP, ASP.NET, and Web Forms. The Visual Basic 6.0 and Visual C+ 6.0 business objects can either be used without modification or upgrad
31、ed to Visual Studio .NET. · DHTML applications contain DHTML pages and client-side DLLs. These applications cannot be automatically upgraded to Visual Basic .NET. We recommend you leave these applications in Visual Basic 6.0. · ActiveX documents are not supported in Visual Basic .NET, and
32、like DHTML projects, cannot be automatically upgraded. We recommend you either leave your ActiveX document applications in Visual Basic 6.0 or, where possible, replace ActiveX documents with user controls. · Visual Basic 6.0 ActiveX documents and DHTML applications can interoperate with Visual
33、Basic .NET technologies. For example, you can navigate from a Visual Basic .NET Web Form to a Visual Basic 6.0 DHTML page, and viceversa. · Webclasses no longer exist in Visual Basic .NET. Webclass applications will be upgraded to ASP.NET; however, you will have to make some modifications after
34、 upgrading. Existing Webclass applications can interoperate with Visual Basic .NET Web Forms and ASP applications, but for new projects we recommend you use the Windows DNA platform of ASP with Visual Basic 6.0 business objectsClient/Server ProjectsVisual Basic 6.0 offered several technologies for c
35、reating client/server applications: · Visual Basic Forms · Microsoft Transaction Server (MTS)/COM+ middle-tier objects · User controls In Visual Basic .NET, there is a new form package: Windows Forms. Windows Forms has a different object model than Visual Basic 6.0 Forms, but is large
36、ly compatible. When your project is upgraded, Visual Basic Forms are converted to Windows Forms.Visual Basic .NET improves support for developing middle-tier MTS and COM+ component services components. Using the unified debugger, you can step from a client application into an MTS/COM+ component and
37、back to the client. You can also use the unified debugger to step through Visual Basic 6.0 MTS/COM+ components (providing they are compiled to native code, with symbolic debug information and no optimizations). Visual Basic .NET also introduces a new middle-tier component, Web Services. Web Services
38、 are hosted by ASP.NET, and use the HTTP transport allowing method requests to pass through firewalls. They pass and return data using industry standard XML, allowing other languages and other platforms to access their functionality. Although they do not support MTS transactions, you may want to cha
39、nge your MTS/COM+ components to Web Services in cases where you do not need distributed transactions but still want to interoperate with other platforms. When your project is upgraded, user controls are upgraded to Windows controls; however, custom property tag settings and accelerator keys assignme
40、nts will not be upgraded.Single-tier ApplicationsVisual Basic 6.0 supported building several types of single-tier applications: · Single-tier database applications · Visual Basic add-ins · Utility programs and games Single-tier database applications are typified by a Visual Basic appl
41、ication storing data in an Microsoft Access database. These applications will upgrade to Visual Basic .NET with some limitations (see the Data section later in this document).Now that the Visual Basic .NET IDE is a fully integrated part of the Visual Studio .NET IDE,the Visual Basic .NET has a new l
42、anguage-neutral extensibility model. Visual Basic .NET add-ins are now Visual Studio .NET add-ins, and you can automate and add features to any language in Visual Studio .NET. For example, you can write a Visual Basic .NET add-in that re-colors a Visual C# Windows Form or adds comments to a Visual B
43、asic class. In order to provide this functionality, Visual Basic .NET has moved away from the old extensibility model, and you will need to change thevery extensibility objects in your application to take advantage of the new features.Many applications fall under the category of Utility programs.Uti
44、lity applications that manipulate files, registry settings, and the like will often upgrade without requiring any additional changes. After upgrading, there are many new features you can take advantage of, such as exception handling in the language to capture file system errors, and using .NET Frame
45、work registry classes to manipulate the registry. One thing to be aware of is that applications relying on specific performance characteristics of Visual Basic 6.0, such as arcade games, will probably require some modifications because Visual Basic .NET has different many performance characteristics
46、. For games support in Visual Basic .NET, you can use Microsoft DirectX® 7, or the new version of GDI. GDI+ introduces many new features, including Alpha blending support for all 2-D graphics primitives, anti-aliasing, and expanded support for image file formats.DataVisual Basic 6.0 offered sev
47、eral types of data access: · ActiveX Data Objects (ADO) · Remote Data Objects (RDO) · Data Access Objects (DAO) Visual Basic .NET introduces an enhanced version of ADO called ADO .NET. ADO .NET targets disconnected data, and provides performance improvements over ADO when used in dist
48、ributed applications. ADO .NET offers read/write data binding to controls for Windows Forms and read-only data binding for Web Forms.DAO, RDO, and ADO can still be used in code from Visual Basic .NET, with some trivial modifications (covered in the language section of this document). However, Visual
49、 Basic .NET does not support DAO and RDO data binding to controls, data controls, or RDO User connection. We recommend that if your applications contain DAO or RDO data binding you either leave them in Visual Basic 6.0 or upgrade the DAO and RDO data binding to ADO before upgrading your project to V
50、isual Basic .NET, as ADO data binding is supported in Windows Forms. Information on how to do this is available in the Visual Basic 6.0 Help.In summary, we recommend using ADO in your Visual Basic 6.0 projects. UpgradingWhen your code is upgraded, Visual Basic .NET creates a new upgraded project and
51、 makes most of the required language and object changes for you. The following sections provide a few examples of how your code is upgraded.Variant to ObjectPrevious versions of Visual Basic supported the Variant datatype, which could be assigned to any primitive type (except fixed-length strings),
52、Empty, Error, Nothing and Null. In Visual Basic .NET, the functionality of the Variant and Object datatypes is combined into one new datatype: Object. The Object datatype can be assigned to primitive datatypes, Empty, Nothing, Null, and as a pointer to an object.When your project is upgraded to Visu
53、al Basic .NET, all variables declared as Variant are changed to Object. Also, when code is inserted into the editor, the Variant keyword is replaced with Object.Visual Basic Forms to Windows FormsVisual Basic .NET has a new forms package, Windows Forms, which has native support for accessibility and
54、 has an in-place menu editor. Your existing Visual Basic Forms are upgraded to Windows Forms.InterfacesIn previous versions of Visual Basic, interfaces for public classes were always hidden from the user. In Visual Basic .NET, they can be viewed and edited in the Code Editor. When your project is up
55、graded, you choose whether to have interface declarations automatically created for your public classes.Upgrade Report and CommentsAfter your project is upgraded, an upgrade report is added to your project, itemizing any changes you will need to make to your upgraded code. Additionally, comments are
56、 added to your code to alert you to any potential problems. These comments show up automatically in the Visual Studio .NET Task List.Programming RecommendationsThis section provides recommendations for how you should write code to minimize the changes you will need to make after upgrading your proje
57、ct to Visual Basic .NET. Use Early-BindingBoth Visual Basic 6.0 and Visual Basic .NET support late-bound objects, which is the practice of declaring a variable as the Object datatype and assigning it to an instance of a class at run time. However, during the upgrade process, late-bound objects can p
58、roduct introduce problems when resolving default properties, or in cases where the underlying object model has changed and properties,methods, and events need to be converted. For example, suppose you have a Form called Form1 with a label called Label1.In Visual Basic .NET Windows Forms, the Caption
59、 property of a label control is now called Text. When your code is upgraded, all instances of the Caption property are changed to Text, but because a late-bound object is type-less, Visual Basic cannot detect what type of object it is, or if any properties should be translated. In such cases, you will need to change the code yourself after upgrading. Visual Basic .NET supports overloading functions based on parameter type. Visual Basic .NET determines which function to call based on the parameter type. If you pass an integer to Environ()
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 八大員-勞務(wù)員模擬習(xí)題與答案
- 醫(yī)療器械測(cè)試題+參考答案
- 中線(xiàn)導(dǎo)管理論考核試題
- 膠合板行業(yè)的人才培養(yǎng)與技能提升考核試卷
- 氮肥產(chǎn)業(yè)在全球農(nóng)業(yè)中的地位與作用考核試卷
- 石材礦山的礦石品質(zhì)分析與評(píng)價(jià)考核試卷
- 派遣員工福利待遇改善措施實(shí)施與評(píng)估考核試卷
- 文化娛樂(lè)產(chǎn)業(yè)政策影響與經(jīng)紀(jì)人應(yīng)對(duì)措施實(shí)施考核試卷
- 生物質(zhì)能發(fā)電與城市垃圾資源化考核試卷
- 礦山開(kāi)采對(duì)大氣環(huán)境影響評(píng)價(jià)考核試卷
- 第18課《井岡翠竹》課件-2024-2025學(xué)年統(tǒng)編版語(yǔ)文七年級(jí)下冊(cè)
- 公立醫(yī)院成本核算指導(dǎo)手冊(cè)
- 第16課《有為有不為》公開(kāi)課一等獎(jiǎng)創(chuàng)新教學(xué)設(shè)計(jì)
- 【MOOC】《思想道德與法治》(東南大學(xué))章節(jié)中國(guó)大學(xué)慕課答案
- 第七章-生物醫(yī)學(xué)工程的倫理問(wèn)題
- MOOC 中醫(yī)與辨證-暨南大學(xué) 中國(guó)大學(xué)慕課答案
- 年產(chǎn)10噸功能益生菌凍干粉的工廠(chǎng)設(shè)計(jì)改
- 焊接件檢驗(yàn)合格率統(tǒng)計(jì)表
- Mayo肘關(guān)節(jié)功能評(píng)分
- 螺栓加工工序卡(共7頁(yè))
- 《焦慮癥基礎(chǔ)知識(shí)》PPT課件.ppt
評(píng)論
0/150
提交評(píng)論