版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
實(shí)用文案VisualBasiclanguageandarithmeticTheUnitedStateslaunchedtheMicrosoftVisualBasic(maybereferredtoVB),isthelatestversionofthecurrentVB2008Beta2(VB9)Chineseversion.Visualmeaningthevisual,visible,referringtothedevelopmentofoperating systems likewindows graphical userinterface (Graphic UserInterface,GUI)method,itdoesnotneedtopreparealargenumbercodetodescribetheappearanceoftheinterfaceelementsandlocation,aslongasthepre-Theestablishmentofgooddraganddropobjectsonthescreencorrespondingtothelocation.Basicisactuallyanabbreviationofthephrase;thisphraseisBeginnersall-purposesymbolicinstructioncode,theChinesemeaning"totheinitialdirectiveGMsymbolcodelanguage."VisualBasiclearning,ProfessionalEditionandEnterpriseEditionversionstomeetthedifferentneedsofthedevelopment.StudyandapplytotheordinaryversionofthemajorityoflearnersandtheuseofVisualBasicdevelopmentofthegeneralstaffofWindowsapplications,but;professionalversionforcomputerprofessionaldevelopmentofstaff,includingthestudyoffunctionalversionofthefullcontentcontrolandInternetdevelopmenttoolssuchasadvancedfeatures,Enterprisecontainnotonlyalltheprofessionalversionofthecontent,thereareautomatedtoolssuchasComponentManager,professionalprogrammerstomakethedevelopmentofapowerfulgroupessenceofdistributedapplications.VisualBasicSection1thesummaryofVisualBasicMicrosoftVisualBasic,(abbreviateVB)astoolthemostofapplicationprogramoneofunderWindowsoperatingplatform.Nomatterbeginnerorprofessionaldeveloper,VBhasallofferedawholesetoftoolstothem,Developmentapplicationprogramthatitcanberelaxedandconvenient.SoVBasmostcomputerfirst-selectedtheABCofprogramminglanguageofbeginner.Visual"meanmethodtoadoptvisualuserofdevelopmentfigureinterface(GUI),needandwritealargenumberofcodegoanddescribe標(biāo)準(zhǔn)實(shí)用文案interfaceappearanceandpositionofelementseldom,Towandshowcontrollingpartthatneedcorrespondingpositiontogetscreencanhelpfiguredesigninterface,useroffigure,;"Basic"meansBASIClanguage,becauseVBisdevelopedonthebasisofalreadyexistingBAISClanguage.VBisakindofprogramminglanguageincommonuseofMicrosoft,It,includingVBAofthenumerousWindowsapplicationsoftwareuseVBlanguageinMicrosoftExcel,MicrosoftAccessed.,Foruserstocarryonthesecondarydevelopment;MakewebpageusemoreVBScriptscriptlanguagesubcollectionofVBtooatpresent.UtilizedataofVBvisitcharacteristicusercanestablishthedatabasetomostdatabaseformsincludingMicrosoftSQLServerandotherenterprisesdatabaseWiththeapplicationprogramoffront,andadjustableserviceendpart.UtilizeActiveX(TM)technology,VBcanusewordprocessor,electronicdatalistheWindowsfunctionthatapplicationprogramoffersextremely,ExcelofMicrosoft,,WordofMicrosoft,,EvencanusebyVBspecialtyeditionorenterpriseapplicationprogramandtargetthateditionestablishdirectly.Theprocedurethatusersestablishedfinallyisareal.EXEfile,canissuefreely.VBofferstudyedition,thespecialtyeditionandenterpriseedition,usetosatisfiedwithdifferentdevelopmentdemands.StudyeditionmakeprogrammingpersonneldevelopWindowsandWindowsapplicationprogramofNTveryeasily.Thespecialtyeditionhasofferedthedevelopinginstrumentwithcompletefunctiontoprogrammingpersonnelofthespecialty,Includestudyingallfunctionsofeditioninthespecialtyedition.Enterpriseeditionallowtheprofessionalpersonneltoestablishstrongdistributedapplicationprogramintheformofgroup.Itincludesallcharacteristicsofthespecialtyedition.Socanchoosedifferenteditionsaccordingtodifferentneeds.Section2integrateddevelopmentenvironmentsIntegratedenvironmentofVBcallIDE,madeupofalotofparts,includetitleboard,menufence,toolfence,controllingpartcase,Andwindowbodywindow,engineeringmanagementdevicewindow,attributewindow,codewindowandwindowbodyoverallarrangement標(biāo)準(zhǔn)實(shí)用文案windowbodyoverallarrangement,etc.ofdesigningetc..Havecoveredallfunctions,suchasdesignwhichdevelopstheapplicationprogram,editting,compilinganddebugging,etc..InVB,theapplicationprogramcallstheprojecttoo.WhenstartVBandopenanewprojectforthefirsttime,canseeandpursueintegrateddevelopmentenvironmentinterfacethatshow.VisualBasicIntegrateddevelopmentenvironmentVBcomeandorganizedevelopmentofapplicationprogramthroughproject,useprojectcomeandmanageandformfilesofapplicationprogram.Oneprojectusestheenvironmenttomakeupbyseveralwindowbodies,standardmodulegenerally.Thesystemmanagesprojectthroughtheprojectmenu,forinstanceaddthewindowbody,quote.Systemallowturnonandmanagealotofprojectsbesides.Section3VisualBasiclanguagebriefintroductionsBasicuseanddotheelementaryhigh-levellanguagethatusedoftenmost.ItsfullnameisBeginner'sAll-purposeSymbolicInstructionCode,abbreviateasBASIC.Asitsnamesuggests,Basiconespeciallyforlanguagethatbeginnerdesign,becauseiteasytolearneasytoknow,Sothebodyispopular.EarlyBasiclanguagetobelongtoandsolvetranslatingtype,socancarryoutlinebyline,Soitcanseetheresultcarriedoutatonce,thisisaveryconvenientdesignforbeginner.Butithaveconceptofstructureeither,onethatisinproceduremaintainandmanagementhaveasmuchasotherlanguageproblems.Butback-endBasiccorrectshortcomingoftheabove(suchasQuickBasic),makeitmayusedforanddevelopthelarge-scalerproceduretoo.Thelanguageisthebasiccomposition,whichformsVBprocedure.VBhasstipulatedtheformofsentencesandfunction.Grammar:Thesentencedefinesincantations[Sentencebody]Sentencedefineagreewithandusedinfixedfunctionofsentence,sentencebodyappointconcretecontentorwantconcreteoperationthatcarryoutofsentence.AllsetofsentenceVBlanguage,carryonwithVBsentenceorganicassociationfinishacertainspecificfunctiontheprocedure.Interface+procedurecansolveacertainapplication標(biāo)準(zhǔn)實(shí)用文案problem.VBapplicationprogramcodewindowwritein"codeeditingmachine"generally."editingmachineofcode"islikethewordprocessingsoftwareofapieceofheightspecialization,therearemanyeasiesfunctionofwritingVBcode,Pursuetoshow[ExampleEx-Hello]In"codeeditingmachine"codethatwindowwritten.“Editingmachineofcode”windowSection4developtheapplicationprogramwithVisualBasicUseVBprogramming,designappearanceofapplicationprogramfirstgenerally,writeeverytargetprocedurecodeorothertreatmentprocedureofincidentrespectively,Workofprogrammingshouldbelightmore.Theprocedureofestablishingtheapplicationprogramisasfollows:EstablishapplicationprograminterfaceTheinterfaceisthemutualbridgeofuserandprocedure,Generallyformedofwindowbodyandvisionframeofthebutton,menu,textframeset.withstandardWINDOWSinterfaceofapplicationprogramthatVBestablish.Requireaccordingtofunctionofprocedureanduserandneedofinformationinterchangeofprocedure,Cometoconfirmthatneedthosetargets,plantheoverallarrangementoftheinterface.2.DesignbyeachattributesoftargetininterfaceDemandandsetupeachattributeoftargetsuchasappearance,name,,sizeoftargeted.accordingtointerfaceofplanning.Mostattributepersonwhofetchcansetupthroughtheattributewindowwhendesignalready,Toocansetuprevisingwhenoperatinginprocedurethroughprogramminginprocedurecode.Havethetargetsrespondprogrammingbyprocedurecode3.RespondprocedurecodeofprogrammingtargetInterfacedetermineappearanceofprocedureonly,designwindowaddcodesthrough"codeeditingmachine"soonaftertheinterface,Realizesomemakethetasks,suchasresponding,informationprocessing,etc.afteracceptingexternalmessage,Addcode,realizesomeresponse,informationprocessingthatmakeafteracceptingexternalinformationtask,Aseditor'swindowofcodepursuedshows標(biāo)準(zhǔn)實(shí)用文案addcodes“codeeditingmachine”window4.KeepprojectOneVBprocedureoneproject,atthetimeofdesigningaapplicationprogram,systemwillsetuponebeexpandedandcalled.Projectfileofvbp,projectfileincludeallrelevantinformationoffilethatprojectsetupthis,Keepprojectkeepassociateddocumentsofprojectthisatthesametime.Forexamplethewindowbodyproducedwhendesigninterfacesiskeptandbeingexpandedandbeingcalled.Frmsum.Inthewindowbodyoffoxfire.Atthetimeofopeningaproject(file),thisprojectrelevantfilesloadatthesametime.5.OperateanddebuggedbyprocedureOperatetheprocedurethoroughpinoperate"selectinginthemenu,whenthemistakeappears,VBsystemcanofferinformationpromptcanlookedforandgetridofthemistakethoroughpindebug"withinoperate"menustoo.6.CanproducebyexecutiveprogramFormakeprocedurecanbreakawayfromVBenvironment,ordertobecomenextlifethrough"file""producingproject1.exe"ofmenubutexecutiveprogram(eyeful),Cancarryoutthisfiledirectlyafterthis.Inproduce,+executiveprogram,andthenthroughinstallguidebaleallassociateddocuments,Canrunindependentlyafterinstallationundertheenvironmentofwindows9x/2000asasoftwareproduct.Incomputersystem'sanysoftware,isbytheeverylargeorsmalleachkindofsoftwareconstituentconstitution,deferstothespecificalgorithmtorealizerespectively,thealgorithmqualitydirectdecisionrealizesthesoftwareperformancefitandunfitquality.Designsthealgorithmwithanymethod,whatresourcesdesignsthealgorithmtoneed,requireshowmanyrunningtime,howmanystoragespace,howtodetermineanalgorithmthequality,whenrealizesasoftware,ismustgivetosolve.Incomputersystem'soperatingsystem,thelanguagecompilingsystem,thedatabasemanagementsystemaswellasinvariouscomputerapplicationsystem'ssoftware,mustuseeachoneconcretealgorithmtorealize.Therefore,thealgorithmdesignandtheanalysisarethe標(biāo)準(zhǔn)實(shí)用文案computerscienceandatechnicalcorequestion.Thealgorithmistheproblem-solvingstep,wemaydefinethealgorithmChengJieadeterminationclassquestiontherandomonespecialmethod.Inthecomputerscience,thealgorithmneedstousethecomputeralgorithmiclanguagetodescribe,thealgorithmrepresentswiththecomputersolvesakindofquestionprecisely,theeffectivemethod.Thealgorithmconstructionofdata=procedure,solvesonetoassignmaycalculateorthesolvablequestion,thedifferentpersonmaycompilethedifferentprocedure,solvestheidenticalproblem,herehastwoproblems:First,withcomputationalmethodcloserelatedalgorithmquestion;Second,programmingtechnicalquestion.Betweenthealgorithmandtheprocedurehasthecloserelationship.Thealgorithmisagrouphasthepoorrule,theyhadstipulatedsolvessomespecifictypequestionaseriesofoperations,istotheproblemsolvingplanaccurateandthecompletedescription.Formulatesanalgorithm,generallymustpassthroughstagesandsoondesign,confirmation,analysis,code,test,debugging,time.Toalgorithmstudyincludingfiveaspectcontents:①Designalgorithm.Thealgorithmdesignworkisimpossiblecompletelytheautomation,shouldstudytheunderstandingalreadybythepracticetoprovethatwastheusefulsomebasicalgorithmdesignmethod,thesebasicdesignmethodwasnotonlysuitableforthecomputerscience,moreoverwassuitablefordomainsandsoonelectricalengineering,operationsresearch;②Expressesthealgorithm.Thedescriptionalgorithm'smethodhasmanykindsofforms,forexamplethenaturallanguageandthealgorithmiclanguage,havethesuitableenvironmentandthecharacteristicrespectively;③Confirmsthealgorithm.Thealgorithmconfirmedthegoaliscausesthepeopletobelievefirmlythatthisalgorithmcanworkunmistakablycorrectly,namelythisalgorithmhasthecircularity.Thecorrectalgorithmdescribeswiththecomputeralgorithmiclanguage,constitutesthecomputerprogram,thecomputerprogrammovesonthecomputer,obtainsthealgorithmoperationresult;④Parsingalgorithm.Thealgorithmicanalysisisrequireshowmanycomputingtimeandthestoragespacetoanalgorithmmakesthequotatheanalysis.Theparsingalgorithmmayforecastthatwhatenvironment標(biāo)準(zhǔn)實(shí)用文案thisalgorithmdoessuitinmoveseffectively,tosolvestheidenticalquestiondifferentalgorithmvaliditytomakethecomparison;⑤Confirmationalgorithm.Withmachinelanguagedescriptionalgorithmwhethercancalculateeffectively,reasonable,mustcarryonthetesttotheprocedure,thetestorderworkandmakesthespaceandtimedistributionmapbythedebuggingtobecomposed.Butthealgorithmhascertaincharacteristic,itincludes:①Determinism.Algorithmeachkindofoperationmusthavethedeterminationsignificance,thiskindofoperationshouldcarryoutwhatkindofmovementshouldnottohavetheambiguity,thegoalisclear;②Effectiveness.Requeststheoperationwhichinthealgorithmwaitsforrealizingisbasic,eachkindofoperationcanatleastcompletesintheprinciplebythehumanwiththepaperandthepeninthelimitedtime;Input.Analgorithmhas0orthemanyinputs,beforethealgorithmoperationstartsgivesthealgorithmtoneedthedatathestartingvalue,theseinputsarefromthespecificobjectset;④Output.Doesforthealgorithmoperationresult,analgorithmhasormanyoutputs,theoutputhassomekindofspecificrelationalquantitywiththeinput;⑤Haspoor.Analgorithmalwaysaftercarryingouthadthepoorstepoperationhasterminated,namelythisalgorithmwasmayreach.Satisfiesafirstfourcharacteristicgroupofrulenottobeabletobecalledthealgorithm,canonlybecalledthecomputationalprocess,theoperatingsystemisacomputationalprocessexample,theoperatingsystemusesfortomanagethecomputerresources,controlsthemanufactureindustrymovement,whenhasnotmadeindustrythemovement,thecomputationalprocessdoesnotstop,butisatthewaitingstatus.Thealgorithmcomplexityisthealgorithmefficiencymeasure,whenappraisesthealgorithmperformance,thecomplexityisanimportantbasis.Thealgorithmcomplexdegreewithmovescomputerresourceshowmanywhichthisalgorithmneedsrelated,needstheresourcesaremore,indicatedthatthisalgorithmthecomplexityishigher;Needstheresourcesareless,indicatedthatthisalgorithmthecomplexityislower.Thespatialresources,whichcomputer’sresources,operatemost標(biāo)準(zhǔn)實(shí)用文案importantly,needsthetimewhichandthestoredroutineandthedataneed,thealgorithmcomplexityhasdivisiontimecomplexityandthespatialcomplexity.Thealgorithmcarriesouttheoperationonthecomputer,needsthedata which certain storage spacedepositing description algorithm theprocedure and the algorithm need, the computer completes theoperation task to require certain time. The procedure which writesaccording to the different algorithm places when on the computeroperates, needs the time and the space aredifferent, the algorithmcomplexityisneedsthetimeandthespatialonekindofmeasuretothealgorithm operation. The different computer its operating speeddifferenceisverybig,isweighinganalgorithmthecomplexitytonotethispoint.Regardingquestion,whichassignswillfully,aprofitabletargetwhichdesigns, the complexlow algorithm isasfaraspossible when designsalgorithm considered. Moreover, when the question, which assignsalreadywhenhasmanykindsofalgorithms,animportantcriterionwhichchoicecomplexitylow,iswhenselectsalgorithmshouldfollow.Therefore,thealgorithmcomplexanalysisorselectstothealgorithmdesignhastheimportantguidingsenseandtheusevalue.When discussion algorithm complexity, two questions needtoclarify:(1)Analgorithm'scomplexityexpresseswithwhatkindofquantity;(2)Howtocalculateonetoassignthealgorithmthecomplexity.Afterfindingsolvesaquestionthealgorithm,isthisalgorithmrealization,asforwhethercouldfindthemethodwhichrealized,wasdecidedinthealgorithmcircularityandthecomputationcomplexity,whetherthisquestiondidhavethesolutionalgorithm,whethertoprovidethetimeresourceswhichandthespatialresourcesthealgorithmneeded.標(biāo)準(zhǔn)實(shí)用文案VisualBasic 語(yǔ)言與算法1991年,美國(guó)微軟公司推出了 VisualBasic(可簡(jiǎn)稱VB),目前的最新版本是VB2008Beta2(VB9)中文版。Visual意即可視的、可見(jiàn)的,指的是開(kāi)發(fā)像windows操作系統(tǒng)的圖形用戶界面(GraphicUserInterface,GUI)的方法,它不需要編寫大量代碼去描述界面元素的外觀和位置,只要把預(yù)先建立好的對(duì)象拖放到屏幕上相應(yīng)的位置即可。Basic實(shí)際上是一個(gè)短語(yǔ)的縮寫,這個(gè)短語(yǔ)就是 Beginners all_purposesymbolicinstructioncode ,其中文意思為“初始者通用符號(hào)指令代碼語(yǔ)言” 。VisualBasic有學(xué)習(xí)版、專業(yè)版和企業(yè)版三種版本,以滿足不同的開(kāi)發(fā)需要。學(xué)習(xí)版適用于普通學(xué)習(xí)者及大多數(shù)使用 VisualBasic開(kāi)發(fā)一般Windows 應(yīng)用程序的人員,但是;專業(yè)版適用于計(jì)算機(jī)專業(yè)開(kāi)發(fā)人員, 包括了學(xué)習(xí)版的全部?jī)?nèi)容功能以及Internet 控件開(kāi)發(fā)工具之類的高級(jí)特性;企業(yè)版除包含專業(yè)版全部的內(nèi)容外,還有自動(dòng)化構(gòu)件管理器等工具, 使得專業(yè)編程人員能夠開(kāi)發(fā)功能強(qiáng)大的組骨子里分布式應(yīng)用程序。VisualBasic第1節(jié)VisualBasic 的概述標(biāo)準(zhǔn)實(shí)用文案MicrosoftVisualBasic( 簡(jiǎn)稱VB)是在Windows 操作平臺(tái)下設(shè)計(jì)應(yīng)用程序的最速度、最簡(jiǎn)捷的工具之一。不論是初學(xué)者還是專業(yè)開(kāi)發(fā)人員, VB都為他們提供了一整套的工具,可以輕松方便的開(kāi)發(fā)應(yīng)用程序。因此, VB一直被作為大多數(shù)電腦初學(xué)者的首選入門編程語(yǔ)言。“Visual”指的是采用可視化的開(kāi)發(fā)圖形用戶界面( GUI)的方法,一般不需要編寫大量代碼去描述界面元素的外觀和位置,而只要把需要的控件拖放到屏幕上的相應(yīng)位置即可方便圖形設(shè)計(jì)圖形用戶界面;“Basic”指的是BASIC語(yǔ)言,因?yàn)閂B是在原有的BAISC語(yǔ)言的基礎(chǔ)上發(fā)展起來(lái)的。VB是Microsoft 的一種通用程序設(shè)計(jì)語(yǔ)言,它包括在 MicrosoftExcel 、MicrosoftAccess 等眾多Windows 應(yīng)用軟件中的VBA都使用VB語(yǔ)言,以供用戶進(jìn)行二次開(kāi)發(fā);目前制作網(wǎng)頁(yè)使用較多的 VBScript 腳本語(yǔ)言也是VB的子集。利用VB的數(shù)據(jù)訪問(wèn)特性用戶可以對(duì)包括 MicrosoftSQLServer 和其他企業(yè)數(shù)據(jù)庫(kù)在內(nèi)的大部分?jǐn)?shù)據(jù)庫(kù)格式創(chuàng)建數(shù)據(jù)庫(kù)和前端應(yīng)用程序, 以及可調(diào)整的服務(wù)端部件。利用 ActiveX(TM) 技術(shù),VB可使用Microsoft Word 字處理器、Microsoft Excel電子數(shù)據(jù)表極其他 Windows 應(yīng)用程序提供的功能,甚至可直接使用由VB專業(yè)版或企業(yè)版創(chuàng)建的應(yīng)用程序和對(duì)象。用戶最終創(chuàng)建的程序是一個(gè)真正的 .EXE文件,可以自由發(fā)布。VB提供了學(xué)習(xí)版,專業(yè)版和企業(yè)版,用以滿足不同的開(kāi)發(fā)需求。學(xué)習(xí)版使編程人員很容易地開(kāi)發(fā) Windows 和WindowsNT 的應(yīng)用程序。專業(yè)版為專業(yè)編程人員提供了功能完備的開(kāi)發(fā)工具, 專業(yè)版中包含了學(xué)習(xí)版的所有功能。 企業(yè)版允許專業(yè)人員以小組的形式來(lái)創(chuàng)建強(qiáng)大的分布式應(yīng)用程序。 它包括專業(yè)版的所有的特性。所以可以根據(jù)不同的需要來(lái)選擇不同的版本。第2節(jié)集成開(kāi)發(fā)環(huán)境VB的集成環(huán)境或稱 IDE,由多個(gè)部分組成,包含了標(biāo)題欄、菜單欄、工具欄、控件箱,以及窗體設(shè)計(jì)器窗口、工程管理器窗口、屬性窗口、代碼窗口和窗體布局窗體布局等。覆蓋了開(kāi)發(fā)應(yīng)用程序的設(shè)計(jì)、編輯、編譯和調(diào)試等所有功能。在VB中,應(yīng)用程序也稱工程。當(dāng)?shù)谝淮螁?dòng) VB并打開(kāi)一個(gè)新工程時(shí),可以看到如圖所示的集成開(kāi)發(fā)環(huán)境界面。VisualBasic 集成開(kāi)發(fā)環(huán)境VB通過(guò)工程來(lái)組織應(yīng)用程序的開(kāi)發(fā),使用工程來(lái)管理構(gòu)成應(yīng)用程序的所有文件。一個(gè)工程一般由若干個(gè)窗體、 標(biāo)準(zhǔn)模塊以及應(yīng)用環(huán)境組成。 系統(tǒng)通過(guò)工程菜單來(lái)對(duì)工程進(jìn)行管理,如添加窗體、引用等。系統(tǒng)允許同時(shí)打開(kāi)和管理多個(gè)工程。標(biāo)準(zhǔn)實(shí)用文案第3節(jié)VisualBasic 語(yǔ)言簡(jiǎn)介Basic是最常被用來(lái)做入門使用的高級(jí)語(yǔ)言。它的全名是 Beginner’sAll-purposeSumbolicInstructionCode ,簡(jiǎn)稱為 BASIC。顧名思義,Basic就是一種專為初學(xué)者設(shè)計(jì)的語(yǔ)言,因其易學(xué)易懂,所以身受歡迎。早期的 Basic語(yǔ)言都是屬于解譯式的,因此可以一行一行地執(zhí)行,所以它可以立刻看到執(zhí)行的結(jié)果,對(duì)初學(xué)者來(lái)說(shuō)這是很方便的設(shè)計(jì)。不過(guò)它也因此沒(méi)有結(jié)構(gòu)化的概念,在程序的維護(hù)及管理上比起其他語(yǔ)言困難許多。不過(guò)在后期的Basic則改正了以上的缺點(diǎn)(如QuickBasic),使得它也可以用來(lái)開(kāi)發(fā)較大型的程序。語(yǔ)言是構(gòu)成VB程序的基本成分。VB規(guī)定了語(yǔ)句格式和功能。語(yǔ)法:語(yǔ)句定義符[語(yǔ)句體]語(yǔ)句定義符用于規(guī)定語(yǔ)句的功能,語(yǔ)句體指定語(yǔ)句的具體內(nèi)容或要執(zhí)行的具體操作。所有語(yǔ)句的集合就是VB語(yǔ)言,用VB語(yǔ)句進(jìn)行有機(jī)組合完成某個(gè)特定功能就是程序。界面+程序就能解決某個(gè)應(yīng)用問(wèn)題。VB應(yīng)用程序代碼一般在“代碼編輯器”窗口編寫?!按a編輯器”像是一個(gè)高度專門化的字處理軟件,有很多便于編寫 VB代碼的功能,圖所示為 [例Ex-Hello]在“代碼編輯器”窗口編寫的代碼。“代碼編輯器”窗口第4節(jié)用VisualBasic開(kāi)發(fā)應(yīng)用程序使用VB編程,一般先設(shè)計(jì)應(yīng)用程序的外觀,然后再分別編寫各對(duì)象事件的程序代碼或其他處理程序,編程的工作要輕松多。創(chuàng)建應(yīng)用程序的步驟如下:1.創(chuàng)建應(yīng)用程序界面界面是用戶和程序交互的橋梁,用 VB創(chuàng)建的標(biāo)準(zhǔn)的WINDOWS 應(yīng)用程序的界面一般由窗體和按鈕、菜單、文本框的圖象框等構(gòu)成。根據(jù)程序的功能要求和用戶與程序之間的信息交流的需要,來(lái)確定需要那些對(duì)象,規(guī)劃界面的布局。2.設(shè)計(jì)界面上各個(gè)對(duì)象的屬性根據(jù)規(guī)劃的界面要求設(shè)置各個(gè)對(duì)象的屬性,比如對(duì)象的外貌、名稱、顏色、大小等。大多數(shù)屬性取值既可以在設(shè)計(jì)時(shí)通過(guò)屬性窗口來(lái)設(shè)置, 也可以在程序代碼中通過(guò)編程在程序運(yùn)行時(shí)設(shè)置修改。3.編程對(duì)象響應(yīng)的程序代碼界面僅僅決定了程序的外觀,設(shè)計(jì)完界面后就要通過(guò)“代碼編輯器”窗口來(lái)添加代碼,實(shí)現(xiàn)一些在接受外界信息后作出響應(yīng)、信息處理等任務(wù),標(biāo)準(zhǔn)實(shí)用文案添加代碼,實(shí)現(xiàn)一些在接受外界信息后作出的響應(yīng)、信息處理等任務(wù),添加代碼如圖的代碼編輯窗口所示“代碼編輯器”窗口4.保存工程一個(gè)VB程序就是一個(gè)工程,在設(shè)計(jì)一個(gè)應(yīng)用程序時(shí),系統(tǒng)會(huì)建立一個(gè)擴(kuò)展名為.vbp 的工程文件,工程文件包含了該工程所建立的所有文件的相關(guān)信息,保存工程就同時(shí)保存了該工程的所有相關(guān)文件。比如當(dāng)設(shè)計(jì)界面時(shí)產(chǎn)生的窗體保存在擴(kuò)展名為.frm和.frx的窗體文件中。在打開(kāi)一個(gè)工程(文件)時(shí),該工程有關(guān)的所有文件同時(shí)被裝載。5.行和調(diào)試程序通過(guò)“運(yùn)行”菜單中的選項(xiàng)來(lái)運(yùn)行程序,當(dāng)出現(xiàn)錯(cuò)誤時(shí), VB系統(tǒng)可以提供信息提示也可通過(guò)“調(diào)試”和“運(yùn)行”菜單來(lái)查找和排除錯(cuò)誤。6.生成可執(zhí)行程序?yàn)榱耸钩绦蚩梢悦撾xVB環(huán)境,通過(guò)“文件”菜單中的“生成工程1.exe”命令來(lái)生成可執(zhí)行程序(.exe文件),此后即可直接執(zhí)行該文件。在生成可+執(zhí)行程序后,再通過(guò)安裝向?qū)⑺邢嚓P(guān)文件打包,就可以作為一個(gè)軟件產(chǎn)品在windows9x/2000環(huán)境下安裝后獨(dú)立運(yùn)行VB的數(shù)據(jù)庫(kù)編程方面按其難易程度可分為三類(由易到難);●使用數(shù)據(jù)庫(kù)控制項(xiàng)和綁定控制項(xiàng)●使用數(shù)據(jù)庫(kù)對(duì)象變量進(jìn)行編程●直接調(diào)用ODBC2.0API在使用VB進(jìn)行數(shù)據(jù)庫(kù)編程時(shí),通常,會(huì)首先選擇三種基本方法之一來(lái)進(jìn)行數(shù)據(jù)庫(kù)應(yīng)用程序的方案設(shè)計(jì) ,現(xiàn)在就將以上三種設(shè)計(jì)方法的適應(yīng)范圍及其優(yōu)缺點(diǎn)進(jìn)行一個(gè)比較。使用數(shù)據(jù)庫(kù)控制項(xiàng)和綁定控制項(xiàng)1.1優(yōu)點(diǎn)它是三種方法中編碼量最小的不必了解CDBC2.0API的細(xì)節(jié)允許使用標(biāo)準(zhǔn)的和第三方廠商制訂的控制項(xiàng)簡(jiǎn)化了錯(cuò)誤處理支持所有的動(dòng)態(tài)集方法及屬性1.2缺點(diǎn)不能存取快照對(duì)象(snapshop)對(duì)象或表格對(duì)象(都屬于記錄集對(duì)象)不能存取數(shù)據(jù)庫(kù)集合,比如表定義(TableDefs)字段(Fieds),索引(Indexes)標(biāo)準(zhǔn)實(shí)用文案及查詢定義(QueryDefs)只能存取部分ODBC2.0管理函數(shù)不能進(jìn)行真正的事務(wù)處理有限的錯(cuò)誤診斷功能1.3應(yīng)用對(duì)中小規(guī)模的數(shù)據(jù)庫(kù)表(通常少于一千條記錄)只進(jìn)行簡(jiǎn)章的瀏覽操作基本SQL查詢所對(duì)應(yīng)的結(jié)果集長(zhǎng)度有限(通常結(jié)果集的記錄數(shù)小于一百,這些記錄從一個(gè)或兩個(gè)長(zhǎng)度有限的表中檢索出來(lái))應(yīng)用程序的數(shù)據(jù)輸入/輸出項(xiàng)較少(通常只涉及一個(gè)或兩個(gè)長(zhǎng)度有限的表、并且表中的字段數(shù)在10個(gè)左右且不具有關(guān)系完整性限制使用數(shù)據(jù)庫(kù)對(duì)象變量進(jìn)行編程2.1優(yōu)點(diǎn)可以在程序中存取 ODBC2.0的管理函數(shù)可以控制多種記錄集類型 :Dynaset、Snapshop 及Table記錄集合對(duì)象可以存取存儲(chǔ)過(guò)程和查詢動(dòng)作可以存取數(shù)據(jù)庫(kù)集合對(duì)象 ,例如TableDefs、Fields、Indexes及QueryDefs具有真正的事務(wù)處理能力 ,包括啟動(dòng)事務(wù) (Begintrans) 、提交事務(wù)(CommitTrans) 及回滾事務(wù)(Rollback)2.2缺點(diǎn)比使用數(shù)據(jù)控制項(xiàng)的方法編碼量較大只能進(jìn)行間接的錯(cuò)誤處理和錯(cuò)誤恢復(fù)對(duì)每個(gè)數(shù)據(jù)庫(kù)操作沒(méi)有細(xì)粒度的控制對(duì)結(jié)果集和包含結(jié)果集的內(nèi)豐資源的操作受到限制同直接使用ODBC2.0API函數(shù)的方法相比性能較低2.3應(yīng)用應(yīng)用程序需要在執(zhí)行期間動(dòng)態(tài)地建立表、字段及索引 .應(yīng)用程序涉及同步更新幾張表 (但在邏輯上保持一致性 )的復(fù)雜事務(wù)應(yīng)用程序使用結(jié)果集而不是 Dynaset 的窗體(FORMS),例如Snapshots 或Tables,這里是設(shè)計(jì)要考慮的關(guān)鍵應(yīng)用程序的表非常大,多于1000條記錄應(yīng)用程序具有復(fù)雜的數(shù)據(jù)輸入 /輸出項(xiàng),它涉及許多內(nèi)部相關(guān)的字段并且包括數(shù)據(jù)庫(kù)參照完整性或一致性規(guī)則應(yīng)用
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 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ì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2026年黑龍江林業(yè)職業(yè)技術(shù)學(xué)院高職單招職業(yè)適應(yīng)性測(cè)試模擬試題及答案詳細(xì)解析
- 2026貴州省退役軍人事務(wù)廳所屬事業(yè)單位招聘2人考試重點(diǎn)試題及答案解析
- 2026年青海衛(wèi)生職業(yè)技術(shù)學(xué)院?jiǎn)握新殬I(yè)技能考試備考試題含詳細(xì)答案解析
- 2026年湖北城市建設(shè)職業(yè)技術(shù)學(xué)院?jiǎn)握芯C合素質(zhì)考試備考題庫(kù)含詳細(xì)答案解析
- 2026年朝陽(yáng)師范高等??茖W(xué)校單招職業(yè)技能考試備考題庫(kù)含詳細(xì)答案解析
- 2026年安徽工業(yè)職業(yè)技術(shù)學(xué)院?jiǎn)握芯C合素質(zhì)筆試備考題庫(kù)含詳細(xì)答案解析
- 2026年寧夏財(cái)經(jīng)職業(yè)技術(shù)學(xué)院?jiǎn)握新殬I(yè)技能考試備考題庫(kù)含詳細(xì)答案解析
- 2026年山西經(jīng)貿(mào)職業(yè)學(xué)院?jiǎn)握新殬I(yè)技能考試備考題庫(kù)含詳細(xì)答案解析
- 2026山東濟(jì)南高新區(qū)龍奧大廈附近小學(xué)招聘派遣制小學(xué)數(shù)學(xué)代課老師1人參考考試試題及答案解析
- 2026年廣東工貿(mào)職業(yè)技術(shù)學(xué)院?jiǎn)握芯C合素質(zhì)考試模擬試題含詳細(xì)答案解析
- 2026年汽車美容店員工績(jī)效工資考核辦法細(xì)則
- 公路施工安全管理課件 模塊五 路基路面施工安全
- 2025智能化產(chǎn)業(yè)市場(chǎng)深度觀察及未來(lái)方向與投資潛力研究調(diào)研報(bào)告
- 藥企產(chǎn)品經(jīng)理工作全解析
- 江蘇省蘇州市相城區(qū)南京師范大學(xué)蘇州實(shí)驗(yàn)學(xué)校2025年蘇教版小升初考試數(shù)學(xué)試卷(含答案)
- 護(hù)士夜班應(yīng)急預(yù)案
- 新版二年級(jí)道德與法治《我們都是中國(guó)人》教學(xué)設(shè)計(jì)(2課時(shí))
- 個(gè)人借款合同模板
- 經(jīng)濟(jì)學(xué)研究的前沿領(lǐng)域與趨勢(shì)-經(jīng)濟(jì)學(xué)研究前沿
- 2026屆安徽省六安皋城中學(xué)七年級(jí)數(shù)學(xué)第一學(xué)期期末考試試題含解析
- 合肥大棚豬舍施工方案
評(píng)論
0/150
提交評(píng)論