版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
#/16外文文獻(xiàn)原文:ReadytoupgradeVisualBasic6.0applicationstoVisualBasic.NETOutlineThisdocumentistouseMicrosoft?VisualBasic?developerstoprovidetheapplicationtoupgradetoMicrosoftVisualBasic.NETrecommendations.VisualBasic.NETcanopentheVisualBasic6.0projectstoVisualBasic.NETupgradeitstechnology.However,inmostcases,theprojecttoupgradetoVisualBasic.NET,youneedtomakesomechangestotheproject.ThepurposeofthisdocumentisonthedesignandimplementationofthecurrentVisualBasicprojecttoproviderecommendationstoupgradetoVisualBasic.NETonlyafteraminimumofchanges.Whereappropriate,wewillusethenewlanguagestructure;However,thisdocumentisnotalanguagereferenceforVisualBasic.NET.WhatisVisualBasic.NET?VisualBasic.NETisthenextversionofVisualBasic.Microsoftre-designedtheproduct,ratherthansimplyasVisualBasic6.0addsomenewfeatures.Thenewversioneasierthanpreviousversionsofthepreparationofdistributedapplications,suchasWebandenterprisen-tiersystem.VisualBasic.NETwithtwonewformspackages(WindowsFormsandWebForms);usedtoaccessthedisconnectedADOdatasourceforthenewversion;thelatestmodelofthelanguage,removethetraditionalkeyword,improvedtypesecurityandadvanceddevelopersneedtoopenalow-levelstructure.ThesenewfeaturesfortheVisualBasicdeveloperopenedanewdoor:UsetheWebFormsandADO.NET,torapidlydevelopscalableWebsites;throughtheinheritance,thelanguagecanbearealobject-orientedprogrammingsupport;Windowswindowbodyitselftosupportaccessandvisualinheritance;nowdeployyourapplicationastheexecutablefilesandcomponentsfromonedirectorytoanotherdirectorysosimple.VisualBasic.NETisnowavailableinotherlanguagesfullyintegratedwithMicrosoftVisualStudio.NET.Youcannotonlyusedifferentprogramminglanguagetodevelopapplicationcomponents,andyourclasscannowcross-languageinheritancetoinheritclasseswrittenindifferentlanguages.Usingtheunifieddebuggercannowdebugmultiplelanguageapplications,regardlessofwhethertheyarerunlocallyoronaremotecomputer.Finally,nomatterwhatlanguageyouuse,Microsoft.NETFrameworkistheMicrosoftWindows?andInternetprovidesarichAPI.Whynot100percentcompatiblewithVisualBasic.NET?VisualBasic.NETcanbedesignedtoconsidertwooptions:Updatetotheexistingcodebase.NETframeworktorun;orbuildfromscratchtofullyleveragetheplatform'sadvantages.Toreachthecustomersmostinneedoffeatures(suchasinheritanceandThreading),toprovidetheplatformforfullandunrestrictedaccess,andtoensurethenextgenerationofVisualBasiccanaccessWebapplication,therightdecisioninthenewplatformthegenerationfromscratch.Forexample,inWindowsFormsinanumberofnewfeaturescanbeusedasnewcontrolsormorepropertiestoaddtotheexistingcodebase.However,thiswillputallotherimportantfunctions(suchassecurityandvisualinheritance)thecostofsuccessiontotheWindowsform.OurmaingoalsistoensurethattheVisualBasiccodecanbecompletelyanduseofotherlanguages(suchasMicrosoftVisualC#,orMicrosoftVisualC++?)writecodetowork,andtoVisualBasicdeveloperseasytouse.NETFrameworkfeatureswithoutusingthetraditionalWindowsAPIprogrammingtoolstomakework.AndVisualC++andanyothercommonlanguageruntimetotargetthesamelanguage,VisualBasicnowhasthesamevariabletype,array,user-definedtypes,classesandinterfaces;butwehaveremovedfromthelanguageofcertainfunctions,Forexample,anarrayoffixed-lengthstringsandnon-zero.VisualBasicisnowatrueobject-orientedlanguage;somenon-intuitiveandinconsistentfeaturehasbeenremovedfromthelanguage,suchasGoSub/ReturnandDefInt.TheresultisaVisualBasicmoredynamic,itwillcontinuetobeWindows-basedapplicationthatcreatesthebesttools,andnowtocreatethenextgenerationofWebsitetobethebesttool.UpgradetoVisualBasic.NETVisualBasic.NETfromthebasicprinciplesofthetraditionalWindowsdevelopmenttobuildnextgenerationWebandn-tierapplications.Therefore,youneedtoupgradethecodetousetheadvantagesofVisualBasic.NET.OpeninVisualBasic.NETinVisualBasic6.0project,itwillautomaticallyappear,"UpgradeWizard"toguideyouthroughtheupgradeprocess,andautomaticallycreateanewVisualBasic.NETproject(yourexistingprojectwillnotchange).Thisisaone-wayprocess;inVisualBasic6.0cannotopenanewVisualBasic.NETproject.Worksaftertheupgrade,languagechangeduetosyntaxchanges,yourformisconvertedtoVisualBasic6.0WindowsForms.Inmostcases,theupgradecodealsoneedtobesomechanges.ThisisbecausecertainobjectsandlanguagefeaturesinVisualBasic.NETisnotequivalenttothecontent,orforautomaticupdates,theequivalentcontentdifferencestoo.Aftertheupgrade,mayalsoneedtochangeyourapplicationstouseVisualBasic.NETsomeofthenewfeatures.AtthesametimeusingVisualBasic6.0andVisualBasic.NETVisualBasic.NETsupportforVisualBasic6.0upgradeproject;IfyouhaveaVisualBasic,version1toversion5,thepreparationoftheproject,werecommendthatyouloaditintoVB6(thechoicetoupgradeMicrosoftActiveX?controls),compileandsavetheproject,andthenupgradetheprojecttoVisualBasic.NET.VisualBasic.NETandVisualBasic6.0canbeinstalledonthesamecomputerandrun.Similarly,withVisualBasic.NETandVisualBasic6.0applicationswrittencanalsobeinstalledonthesamecomputerandrunconcurrently.ComponentswrittenusingVisualBasic.NETwithearlierversionsofVisualBasic,andCOMcomponentswritteninotherlanguagestoworktogether.Forexample,canbewrittenusingVisualBasic6.0ActiveXcontrolstoVisualBasic.NETWindowsFormsdraganddrop,useVisualBasic.NETClassLibraryinVisualBasic6.0COMobjects,ortoVisualBasic6.0executabletheVisualBasic.NETLibrary.ComponentswithVisualBasic.NETcompilerandcompiledusingVisualBasic6.0runtimecomponentsareslightlydifferent.Fortheinitialapplication,asVisualBasic.NETobjectsthroughgarbagecollectionrelease,soiftheobjectisexplicitlyremovedfrommemorybeforetheyactuallydelete,maybeadelay.Otherdifferences,suchasvariant/objectchangeswillnotelaterinthisarticle.AresultofthesedifferencesisacommonapplicationwithVisualBasic.NETVisualBasic6.0applicationrunningwithsimilarcharacteristics,butnotidentical.Inaddition,VisualBasic.NETtoVisualBasic.NETandVisualBasic6.0componentsinbetweenthesecomponentsdonotbinarycompatible.Componentsarenowmorepowerfulthanbefore,versionmanagementanddeploymentsystem,youcansimplycopyfilestoadirectory(nolongerRegSvr32)todeploythefile,andupgradetonewversionofthecomponentasanewreplacetheoldfilesaseasy.Youhavetodoistoensurethatclassesandmethodscompatiblewithearlierversions.Architectureproposed.NETplatformontheimprovementofearlyarchitectureonthescalabilityofdistributedapplicationsandtoprovidemorepowerfulsupport,althoughithasdisconnecteddataaccess,message-basedHTTP-basedanddeployment(nolongerisacomponentregistration).Totakefulladvantageofthesefeaturesinthedesignofyourapplicationarchitectureused,shouldbeusedinVisualBasic.NETsimilararchitecture.Browser-basedapplicationsVisualBasic6.0andMicrosoftVisualStudio?6.0tocreateabrowser-basedInternetandIntranetapplicationsprovidethefollowingtypesoftechnologies:WebclassDHTMLprojectActiveXDocumentActiveServerPages(ASP)VisualBasic.NETintroducesanenhancedversionthatisASPASP.NET,andwiththeWebformtothearchitecture,WebformisthecasewithVisualBasicHTMLpage.Architectureisbasedontheserver.Thefollowingrecommendationsandalistofthemainarchitectureproposedforthedevelopmentofbrowser-basedVisualBasic6.0applicationstoenablethemtoseamlesslymigratetoVisualBasic.NETprojects:RecommendthatyoufollowMicrosoftguidelinesformulti-tierarchitecturetocreateyourapplication,usingASPtocreateinterfacesusingVisualBasic6.0orVisualC++6.0COMobjecttocreatebusinesslogic.VisualBasic.NETinfullsupportofASP,youcanuseASP,ASP.NETandWebFormsapplicationstocontinuetoexpand.VisualBasic6.0andVisualC++6.0businessobjectscannotbemodifiedorupgradedtoforVisualStudio.NETorVisualStudio.NET.DHTMLapplications,includingDHTMLpageandtheclientDLL.TheseapplicationsarenotautomaticallyupgradedtoVisualBasic.NET.WerecommendthatyouleavetheseapplicationsintheVisualBasic6.0.VisualBasic.NETdoesnotsupportActiveXdocuments,thesameastheDHTMLprojectdoesnotautomaticallyupdate.WerecommendyoutostayintheActiveXdocumentapplicationinVisualBasic6.0,orpossible,toreplacetheActiveXusercontroldocuments.VisualBasic6.0ActiveXdocumentsandDHTMLapplicationswithVisualBasic.NETtechnologyworktogether.Forexample,youcannavigatefromaVisualBasic.NETWebFormstoVisualBasic6.0DHTMLpage,andviceversa.VisualBasic.NETisnolongeraWebclass.WebclassapplicationwillbeupgradedtoASP.NET,butaftertheupgradeyouneedtomakesomemodifications.WebclassexistingapplicationswithVisualBasic.NETWebFormsandASPapplicationsworktogether,butfornewprojects,werecommendthatyouusewithVisualBasic6.0businessobjectASP'sWindowsDNAplatform.Client/serverprojectVisualBasic6.0toprovideforcreatingclient/serverapplicationofthefollowingtechnologies:VisualBasicformMicrosoftTransactionServer(MTS)/COM+middletierobjects*UserControlVisualBasic.NEThasanewformpackage,orWindowsForms.WindowsFormsandVisualBasic6.0formwithadifferentobjectmodel,butmostarecompatible.Whenyouupgradeproject,VisualBasicformisconvertedtoWindowsForms.VisualBasic.NETdevelopmenttoimprovethemiddlelayerofMTSandCOM+ComponentServicescomponentssupport.Usingtheunifieddebugger,youcanaccessfromtheclientapplicationMTS/COM+components,andthenreturnedtotheclientapplication.YoucanalsousesinglestepdebuggertodebugVisualBasic6.0MTS/COM+components(assumingthecostofthesecomponentsarecompiledmachinecodewithsymbolicdebugginginformationandnooptimization).VisualBasic.NETalsointroducedanewmiddletiercomponents,namelyWebservices.WebServicesinASP.NET,andallowedthroughthefirewallusingtheHTTPtransportprotocolrequestmethod.Theyuseindustry-standardXMLdatatransferandreturn,allowingaccesstotheirotherlanguageandplatformfeatures.AlthoughtheydonotsupporttheMTStransaction,butwhenyoudonotneeddistributedtransactions,butstillneedtoworkwithotherplatforms,youcanputMTS/COM+componentsintoWebservices.Althoughthereisnoautomaticway,butthistaskisverysmall,canbeupgradedtoVisualBasic.NETproject,usethedraganddropinaveryshorttime.Worksupgrade,upgradetoWindowscontrolsusercontrols;butthecustomattributetagstosetupandassignshortcutkeyswillnotupgrade.SingleapplicationVisualBasic6.0supportsthefollowingtypesofsingle-generationapplications:*Single-databaseapplicationVisualBasicadd-insToolsprogramsandgamesSingledatabaseapplication,someVisualBasicapplications,whichischaracterizedintheMicrosoftAccessdatabasetostoredata.TheseapplicationswhenupgradingtoVisualBasic.NETcertainrestrictions(seelaterinthisdocument,"data"section).VisualBasic.NETIDEisnowfullyintegratedintotheVisualStudio.NETIDE,VisualBasic.NETlanguagecenterexpansionwithanewmodel.VisualBasic.NETVisualStudio.NETadd-inisnowtheadd-ins,youcaninanylanguageinVisualStudio.NETautomaticallyprocessedandaddedfunctionality.Forexample,youcanwriteaVisualBasic.NETtore-addfortheVisualC#WindowsFormscoloring,orforVisualBasicClasstoaddcomments.Toprovidethisfunctionality,VisualBasic.NETextensionisnolongerusingtheoldmodel,youneedtochangetheexpansionoftheapplicationobjecttousetheadvantagesofnewfeatures.Manyapplicationsareclassifiedasa"tool"typeofprocedure.Usedtomanipulatefiles,registrysettingstoolsliketheapplicationdoesnotrequireanyadditionalmodificationsoftencanbeupgraded.Aftertheupgrade,therearemanynewfeaturesavailable,suchasthelanguageoftheexceptionhandlingtocatcherrors,anduse.NETFrameworkclassregistryregistrymanipulation.Itshouldbenotedthat,dependentontheparticularVisualBasic6.0applicationperformancecharacteristics(suchasarcadegames)mayrequiresomemodification,becauseVisualBasic.NEThavedifferentperformancecharacteristics.VisualBasic.NETinthegameforsupport,youcanuseMicrosoftDirectX?7oranewversionoftheGDI.GDI+introducesmanynewfeatures,includingalltwo-dimensionalpixel,theimagefidelityoftheAlphaandgraphicssupportedbycombinationofextendedsupport.DataVisualBasic6.0providesthefollowingtypesofdataaccesstypes:ActiveXDataObjects(ADO)RemoteDataObjects(RDO)DataAccessObject(DAO)VisualBasic.NETintroducesanenhancedversionofADO,calledADO.NET.ADO.NETdisconnecteddataused,anddistributedapplicationstoimproveperformanceinADO.ADO.NETfortheWindowsFormscontrolprovidingread/writedatabindingforWebFormsdatabindingtoprovideread-only.InDAO,RDO,andADOminorchanges(inthelanguagesectionofthisdocumentdescribed),itcanstillbeusedinVisualBasic.NETcode.However,VisualBasic.NETdoesnotsupportDAOandRDOdatabindingtocontrols,datacontrols,or"RDOuser"link.IfyourapplicationcontainstheDAOorRDOdatabinding,werecommendthatyouleavetheminVisualBasic6.0,orintheworksbeforetheupgradetoVisualBasic.NET,DAOandRDOdatabindingfirstupgradetotheADO,ADOsupportforWindowsFormsdatabinding.Onhowtodothisworkofinformation,canhelptogetVisualBasic6.0.Insummary,werecommendthatyouuseVisualBasic6.0projectADO.UpgradeUpgradecode,VisualBasic.NETtocreateanewprojecthasbeenupgraded,andyoudomostofthenecessarylanguageandobjectchanges.Thefollowingsectionprovidesafewexamplesofcodeupgrades.VarianttoobjectVisualBasic,Variantdatatypesupportforanearlierversion,youcanassignittoanybasictypes(otherthanfixed-lengthstrings),Empty,Error,Nothing,andNull.InVisualBasic.NETin,VariantandObjectdatatypesintoanewdatatype:Object.Objectcanbeassignedtothebasicdatatypes,Empty,Nothing,Null,andobject.WhenyouupgradetoVisualBasic.NETproject,allthevariablesaredeclaredasVariantturnedintoObject.Similarly,whenthecodeisinsertedaftertheeditor,VariantkeywordisreplacedwithObjectVisualBasicFormstoWindowsFormsVisualBasic.NEThasanewformpackage(ie,WindowsForms),whichprovidesaccesstolocalsupportandaplacemenueditor.YourexistingVisualBasicformwillbeupgradedtoWindowsFormsInterfaceEarlierversionsofVisualBasic,publicclassesareoftenhiddenfromtheuserinterface.InVisualBasic.NET,youcan"codeeditor"intheviewandeditthem.Whentheprojectisupgraded,youcanchoosewhethertoautomaticallycreateinterfacesforthepublicclassstatement.UpgradereportandcommentsAftertheupgradeprojectwilladdtoyourprojectupdatereportoutliningtheneedforthecodehasbeenupgradedallthechanges.Inaddition,thecodewillalsoaddcommentstoremindyoutopotentialproblems.ThesecommentsareautomaticallydisplayedintheVisualStudio.NET"tasklist".ProgrammingrecommendationsThissectionprovidessuggestionsaboutwritingcodeinordertominimizetheworkrequiredtoupgradetoVisualBasic.NETchanges.UseearlybindingVisualBasic6.0andVisualBasic.NETsupportthelatebindingobjects,thatis,declareavariableastheObjectdatatype,andatruntimetoallocateittoclass.However,duringtheupgrade,thedefaultpropertyintheresolution,orintheunderlyingobjectmodelhaschanged,properties,methods,andeventsneedtoconvertthecase,thelate-boundobjectproblems.Forexample,supposeyouhaveaformcalled"Form1",alabelcalled"Label1".InVisualBasic.NETWindowsForm,thelabelingoftheCaptionpropertyiscalledText.Whenyourcodeisupgraded,CaptionpropertyofallinstancesintoaText,butbecausethereisnolate-boundobjecttype,VisualBasiccannotdetectthetypeofobject,ordonotknowwhethertheneedtoconvertalltheproperties.Inthesecases,youneedtochangethecodeaftertheupgradethemselvesWhenyourVisualBasic6.0codetouseObjectandVariantvariables,ifyouwanttospecifyvariables,performoperationsonthevariablesorvariablespassedtothefunction,werecommendthatyouuseexplicitconversionVisualBasic.NETsupportfunctionoverloadingbasedonparametertype.VisualBasic.NETthetypeofcallbasedonparameterswhichfunction.IfyoupasstheintegertoEnviron(),thencalltheintegerversion.Ifyoupassastring,thenthecallstringversion.VariantorObjectdatatypewillbepassedtotheoverloadedfunction,thecodemaycausecompileerrororrun-timeerror.Ifyouusethefollowingexampleshowsanexplicitconversion,thenupgradetoVisualBasic.NETcodeafterwork.Late-boundobjectusingexplicitconversionisgoodcodingpractice.Itmakescodeeasiertojudgeintent,soyoucaneasilytransferprojectinVisualBasic.NET.DatedateusingstoredEarlyversionsofVisualBasicDoubledatatypessupporttheuseofstorageandmanipulationofdates.InVisualBasic.NETcannotdoso,becausethedateisnotstoredintheinternaldouble-precisiontype..NETFrameworkprovidesToOADateandFromOADatefunctionforthedoubleprecisiontypeanddateofconversionbetweenthetypes.However,whenyouupgradetoVisualBasic.NETprojectafterthestorageperiodusingthedouble-precisiontypeofcodeisdifficulttojudgetheintent.ToavoidyourVisualBasic.NETcodeforunnecessarychanges,alwaysusetheDatedatatypestoresdateDefaultpropertieswithoutparametersanalysisInVisualBasic6.0,manyobjectsareopendefaultproperty,asaprogrammingshortcut,youcanomitthedefaultproperty.Inthelatebindingexample,thedefaultpropertiesareresolvedatruntime,MsgBoxTextBoxdefaultvalueofthepropertywillbedisplayedasText1.NoparametersVisualBasic.NETdoesnotsupportdefaultproperties,whichdoesnotallowthisprogrammingshortcut.Whenyouupgradeproject,VisualBasic.NETresolvedefaultpropertywithoutparameters,butrelyonrun-timeanalysisoflatebindingwiththelawcannotautomaticallyresolve.Inthesecases,youmustchangeyourcode.Anothercomplexissueisthatmanylibrariesusethepropertycalled_Defaulttoachievethedefaultproperty._DefaultPropertyasanagent,callsaredeliveredtotherealdefaultproperty.Sowhenyouupgradeprojects,someofthedefaultpropertieswillberesolvedto_Default.Codecanstillworkasusual,buttherealpropertythantheexplicituseofcodewrittenineasytounderstand.So,inyourVisualBasic6.0codetoavoidusingnon-defaultpropertyparameter.中文翻譯稿準(zhǔn)備將VisualBasic6.0應(yīng)用程序升級到VisualBasic.NET概述本文檔為使用Microsoft?VisualBasic?的開發(fā)人員提供有關(guān)將應(yīng)用程序升級到MicrosoftVisualBasic.NET的建議。VisualBasic.NET可以打開VisualBasic6.0工程并將其升級到VisualBasic.NET技術(shù)。但在大多數(shù)情況下,將工程升級到VisualBasic.NET后,需要對工程進(jìn)行一些修改。本文檔的目的是就設(shè)計和實現(xiàn)當(dāng)前VisualBasic工程提供建議,以便升級到VisualBasic.NET后只需進(jìn)行最少的修改。在適當(dāng)?shù)牡胤?,我們將使用新的語言構(gòu)造;但是,本文檔并不用作VisualBasic.NET的語言參考。什么是VisualBasic.NET?VisualBasic.NET是VisualBasic的下一個版本。Microsoft重新設(shè)計了產(chǎn)品,而不僅僅是簡單地為VisualBasic6.0添加某些新功能。新版本比以前的版本更易于編寫分布式應(yīng)用程序,如Web和企業(yè)n-層系統(tǒng)。VisualBasic.NET具有兩個新的窗體包(Windows窗體和Web窗體);用于訪問斷開連接的數(shù)據(jù)源的ADO新版本;最新型的語言、刪除了傳統(tǒng)關(guān)鍵字、提高了類型安全性并公開了高級開發(fā)人員需要的低級別構(gòu)造。這些新功能為VisualBasic開發(fā)人員開啟了一扇新的大門:使用Web窗體和ADO.NET,可以快速開發(fā)可伸縮的Web站點;通過繼承,該語言可真正支持面向?qū)ο蟮木幊?;Windows窗體本身支持訪問和可視繼承;現(xiàn)在部署您的應(yīng)用程序就像把可執(zhí)行文件和組件從一個目錄復(fù)制到另一個目錄那么簡單。VisualBasic.NET現(xiàn)在可與其他MicrosoftVisualStudio.NET語言完全集成。您不僅可以用不同的編程語言開發(fā)應(yīng)用程序組件,而且您的類現(xiàn)在可以通過跨語言繼承性來繼承用不同語言編寫的類。使用統(tǒng)一的調(diào)試程序,現(xiàn)在可以調(diào)試多語言應(yīng)用程序,而不管它們是在本地運行還是在遠(yuǎn)程計算機上運行。最后,無論您使用何種語言,Microsoft.NET框架都為MicrosoftWindows?和Internet提供了豐富的API。為什么VisualBasic.NET不能百分之百兼容?設(shè)計VisualBasic.NET時可以考慮兩種選擇:更新現(xiàn)有代碼的基礎(chǔ)以便在.NET框架上運行;或者從頭開始生成,充分利用平臺的優(yōu)點。要想達(dá)到客戶最需要的功能(例如繼承和線程處理),要想提供對平臺的完全和不受限制的訪問,并確保VisualBasic能進(jìn)入下一代Web應(yīng)用程序,正確的決定是在新的平臺上從頭開始生成。例如,在Windows窗體中的許多新功能都可以作為新控件或更多屬性添加到現(xiàn)有的代碼基礎(chǔ)中。但是,這將以把所有其他重要功能(例如安全性和可視繼承)繼承到Windows窗體為代價。我們的主要目標(biāo)之一就是確保VisualBasic代碼能完全與用其他語言(例如MicrosoftVisualC#?或MicrosoftVisualC++?)編寫的代碼協(xié)同工作,并使VisualBasic開發(fā)人員方便地使用.NET框架的功能,而不必采用傳統(tǒng)的編程手段使WindowsAPI工作。與VisualC++以及其他任何以公共語言運行時為目標(biāo)的語言一樣,VisualBasic現(xiàn)在有相同的變量類型、數(shù)組、用戶定義類型、類和接口;但是我們不得不從語言中去掉了某些功能,例如定長字符串和非零數(shù)組。VisualBasic現(xiàn)在是真正的面向?qū)ο蟮恼Z言;某些不直觀和不一致的功能已經(jīng)從語言中刪除,例如GoSub/Return和DefInt。其結(jié)果是使VisualBasic更具活力,它將繼續(xù)成為創(chuàng)建基于Windows的應(yīng)用程序的最佳工具,并且現(xiàn)在要成為創(chuàng)建下一代Web站點的最佳工具。升級到VisualBasic.NETVisualBasic.NET的基本原則已從傳統(tǒng)的Windows開發(fā)轉(zhuǎn)為生成下一代Web和n-層應(yīng)用程序。因此,您需要升級代碼來利用VisualBasic.NET的優(yōu)點。在VisualBasic.NET中打開VisualBasic6.0工程時,將自動出現(xiàn)“升級向?qū)А币龑?dǎo)您完成升級過程,并自動創(chuàng)建新的VisualBasic.NET工程(您現(xiàn)有的工程不會改變)。這是單向過程;在VisualBasic6.0中不能打開新的VisualBasic.NET工程。工程升級后,語言因語法改變而改變,您的VisualBasic6.0窗體轉(zhuǎn)換為Windows窗體。在大多數(shù)情況下,升級代碼后還需要對其進(jìn)行某些更改。這是因為某些對象和語言功能在VisualBasic.NET中沒有等價內(nèi)容,或者對于自動升級來說,等價內(nèi)容差別太大。升級后,可能還需要改變您的應(yīng)用程序以利用VisualBasic.NET的某些新功能。同時使用VisualBasic6.0和VisualBasic.NETVisualBasic.NET支持升級VisualBasic6.0工程;如果您有一個用VisualBasic版本1到版本5編寫的工程,我們建議您把它加載到VB6中(選擇升級MicrosoftActiveX?控件),編譯并保存該工程,然后再將該工程升級到VisualBasic.NET。VisualBasic.NET和VisualBasic6.0可以安裝到同一臺計算機上,并同時運行。同樣,用VisualBasic.NET和VisualBasic6.0編寫的應(yīng)用程序也可以安裝在同一臺計算機上并同時執(zhí)行。用VisualBasic.NET編寫的組件可以與用VisualBasic早期版本和其他語言編寫的COM組件協(xié)同工作。例如,可以把用VisualBasic6.0編寫的ActiveX控件拖放到VisualBasic.NETWindows窗體上,使用VisualBasic.NET類庫中的VisualBasic6.0COM對象,或者向VisualBasic6.0可執(zhí)行文件中添加到VisualBasic.NET庫的引用。用VisualBasic.NET編譯的組件與用VisualBasic6.0編譯的組件在運行時有細(xì)微的差別。對于起始應(yīng)用程序,由于VisualBasic.NET對象通過垃圾回收釋放,因此如果該對象被顯式地清除,在從內(nèi)存確實刪掉它們之前,可能會有一段延遲。其他的差別,例如變體/對象的變化將在本文后面部分說明。這些差別共同導(dǎo)致的結(jié)果是VisualBasic.NET應(yīng)用程序?qū)⑴cVisualBasic6.0應(yīng)用程序具有相似的運行時特征,但并不完全相同。另外,VisualBasic.NET使VisualBasic.NET組件和VisualBasic6.0中的這些組件之間不需要二進(jìn)制兼容。組件現(xiàn)在有比以前更強大的版本管理和部署系統(tǒng),可以通過簡單地將文件復(fù)制到一個目錄中(不再是RegSvr32)部署該文件,并且升級到新版本組件就像用新文件替換舊文件一樣容易。您所要做的就是確保類和方法與早期版本兼容。體系結(jié)構(gòu)建議.NET平臺對早期體系結(jié)構(gòu)進(jìn)行了改進(jìn),對可伸縮性和分布式應(yīng)用程序提供更強大的支持,盡管它有斷開連接的數(shù)據(jù)訪問、基于HTTP的消息傳輸和基于文件復(fù)制的部署(不再是組件注冊)。為了充分利用這些功能,在設(shè)計您的應(yīng)用程序時所使用的體系結(jié)構(gòu),應(yīng)該與要在VisualBasic.NET中使用的體系結(jié)構(gòu)相似?;跒g覽器的應(yīng)用程序VisualBasic6.0和MicrosoftVisualStudio?6.0為創(chuàng)建基于瀏覽器的Internet和Intranet應(yīng)用程序提供了下列幾種技術(shù):WebclassDHTML工程ActiveX文檔?ActiveServerPages(ASP)VisualBasic.NET引入了ASP的增強版即ASP.NET,并隨Web窗體添加到體系結(jié)構(gòu)中,Web窗體是帶有VisualBasic事件的HTML頁。體系結(jié)構(gòu)是基于服務(wù)器的。下面推薦和體系結(jié)構(gòu)建議的列表主要針對開發(fā)基于瀏覽器的VisualBasic6.0應(yīng)用程序,使其能無縫移植到VisualBasic.NET工程中:建議您按照Microsoft多層體系結(jié)構(gòu)的指導(dǎo)方針來創(chuàng)建您的應(yīng)用程序,用ASP創(chuàng)建界面,用VisualBasic6.0或VisualC++6.0COM對象創(chuàng)建業(yè)務(wù)邏輯。VisualBasic.NET中完全支持ASP,您可以使用ASP、ASP.NET和Web窗體繼續(xù)擴展應(yīng)用程序。VisualBasic6.0和VisualC++6.0業(yè)務(wù)對象可以不進(jìn)行修改即用于VisualStudio.NET或升級到VisualStudio.NET。DHTML應(yīng)用程序包括DHTML頁面和客戶端DLL。這些應(yīng)用程序不能自動升級到VisualBasic.NET。我們建議您把這些應(yīng)用程序留在VisualBasic6.0中。VisualBasic.NET中不支持ActiveX文檔,象DHTML工程一樣不能自動升級。我們建議您把ActiveX文檔應(yīng)用程序留在VisualBasic6.0中,或者在可能的情況下,以用戶控件代替ActiveX文檔。VisualBasic6.0ActiveX文檔和DHTML應(yīng)用程序可以與VisualBasic.NET技術(shù)協(xié)同工作。例如,可以從VisualBasic.NETWeb窗體導(dǎo)航到VisualBasic6.0DHTML頁面,反之亦然。VisualBasic.NET中不再有Webclass。Webclass應(yīng)用程序?qū)⑸壍紸SP.NET,但升級后您必須進(jìn)行一些修改?,F(xiàn)有的Webclass應(yīng)用程序可以與VisualBasic.NETWeb窗體和ASP應(yīng)用程序協(xié)同工作,但對于新工程,我們建議您使用帶VisualBasic6.0業(yè)務(wù)對象的ASP的WindowsDNA平臺??蛻舳?服務(wù)器工程VisualBasic6.0提供用于創(chuàng)建客戶端/服務(wù)器應(yīng)用程序的下列技術(shù):VisualBasic窗體MicrosoftTransactionServer(MTS)/COM+中間層對象用戶控件VisualBasic.NET中有一個新窗體包,即Windows窗體。Windows窗體具有與VisualBasic6.0窗體不同的對象模型,但絕大部分是兼容的。當(dāng)您的工程升級后‘VisualBasic窗體轉(zhuǎn)換為Windows窗體。VisualBasic.NET改進(jìn)了對開發(fā)中間層MTS和COM+組件服務(wù)組件的支持。使用統(tǒng)一的調(diào)試程序,您可以從客戶端應(yīng)用程序進(jìn)入MTS/COM+組件,然后再返回客戶端應(yīng)用程序。您也可以使用統(tǒng)一的調(diào)試程序逐句調(diào)試VisualBasic6.0MTS/COM+組件(假設(shè)這些組件被編譯成本機代碼,帶有符號化調(diào)試信息,并且沒有優(yōu)化)。VisualBasic.NET還引入了一種新的中間層組件,即Web服務(wù)。Web服務(wù)在ASP.NET中,并使用允許通過防火墻請求方法的HTTP傳輸協(xié)議。它們使用行業(yè)標(biāo)準(zhǔn)XML傳遞并返回數(shù)據(jù),允許其他語言和平臺訪問它們的功能。盡管它們不支持MTS事務(wù),但是當(dāng)您不需要分布式事務(wù),而仍需要與其他平臺協(xié)同工作時,可以把MTS/COM+組件轉(zhuǎn)換成Web服務(wù)。盡管沒有自動方式,但此任務(wù)很小,可以在將工程升級到VisualBasic.NET后,使用拖放操作在很短時間內(nèi)完成。工程升級后,用戶控件升級為Windows控件;但自定義屬性標(biāo)記設(shè)置和快捷鍵分配不會升級。單層應(yīng)用程序VisualBasic6.0支持生成下列幾種單層應(yīng)用程序:?單層數(shù)據(jù)庫應(yīng)用程序?VisualBasic加載項?工具程序和游戲單層數(shù)據(jù)庫應(yīng)用程序是一些VisualBasic應(yīng)用程序,其特征是在MicrosoftAccess數(shù)據(jù)庫中存儲數(shù)據(jù)。這些應(yīng)用程序升級到VisualBasic.NET時有某些限制(請參見本文檔后面的“數(shù)據(jù)”部分)。現(xiàn)在VisualBasic.NETIDE完全集成到VisualStudio.NETIDE中,VisualBasic.NET具有新的語言中樞擴展模型。VisualBasic.NET加載項現(xiàn)在是VisualStudio.NET加載項,您可以在VisualStudio.NET的任何語言中自動處理和添加功能。例如,您可以編寫一個VisualBasic.NET加載項來重新為VisualC#Windows窗體著色,或者為VisualBasic類添加注釋。為了提供此項功能,VisualBasic.NET已經(jīng)不再使用舊的擴展模型,您需要更改應(yīng)用程序中的擴展對象來利用新功能的優(yōu)點。許多應(yīng)用程序被歸為“工具”程序類別。用來操縱文件、注冊表設(shè)置之類的工具應(yīng)用程序常常不需要任何額外的修改即可升級。升級后,有許多新功能可供使用,如語言中的異常處理可以捕捉文件系統(tǒng)錯誤,并使用.NET框架注冊表類操縱注冊表。要注意的是,依賴VisualBasic6.0的特定性能特征的應(yīng)用程序(如arcade游戲)可能需要進(jìn)行某些修改,因為VisualBasic.NET有不同的性能特征。對于VisualBasic.NET中的游戲支持,您可以使用MicrosoftDirectX?7或新版本的GDI。GDI+引入許多新功能,包括對所有二維圖元、圖像保真的Alpha混合支持和圖形文件格式的擴展支持。數(shù)據(jù)VisualBasic6.0
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 體育護理專業(yè)就業(yè)前景
- 黑龍江安全試題及答案
- 2025-2026人教版一年級科學(xué)期末考
- 腸易激綜合征的腸-腸軸納米調(diào)節(jié)策略
- 針織廠衛(wèi)生管理制度
- 衛(wèi)生院單位規(guī)章制度
- 養(yǎng)生會衛(wèi)生管理制度
- 木業(yè)職業(yè)病衛(wèi)生管理制度
- 公共衛(wèi)生糖尿病管理制度
- 衛(wèi)生院醫(yī)療管理工作制度
- 安全目標(biāo)管理制度煤廠(3篇)
- 云南省玉溪市2025-2026學(xué)年八年級上學(xué)期1月期末物理試題(原卷版+解析版)
- 2026年哈爾濱通河縣第一批公益性崗位招聘62人考試參考試題及答案解析
- 就業(yè)協(xié)議書解約函模板
- 研發(fā)部門員工加班管理細(xì)則
- 鋼結(jié)構(gòu)橋梁施工監(jiān)測方案
- 2025人教pep版三年級英語上冊字帖
- 《5G移動通信》課件-項目六 5G網(wǎng)絡(luò)中的人工智能技術(shù)
- 2025江蘇蘇州高新區(qū)獅山商務(wù)創(chuàng)新區(qū)下屬國有企業(yè)招聘9人筆試題庫及答案詳解
- 教培機構(gòu)年終工作總結(jié)
- 2025年秋季青島版三年級數(shù)學(xué)上冊求比一個數(shù)的幾倍多(少)幾的數(shù)教學(xué)課件
評論
0/150
提交評論