techtips8 面向VisualBasic程序员的杂志 第8版.docx

上传人:王** 文档编号:1346989 上传时间:2024-06-20 格式:DOCX 页数:53 大小:141.43KB
下载 相关 举报
techtips8 面向VisualBasic程序员的杂志 第8版.docx_第1页
第1页 / 共53页
techtips8 面向VisualBasic程序员的杂志 第8版.docx_第2页
第2页 / 共53页
techtips8 面向VisualBasic程序员的杂志 第8版.docx_第3页
第3页 / 共53页
techtips8 面向VisualBasic程序员的杂志 第8版.docx_第4页
第4页 / 共53页
techtips8 面向VisualBasic程序员的杂志 第8版.docx_第5页
第5页 / 共53页
techtips8 面向VisualBasic程序员的杂志 第8版.docx_第6页
第6页 / 共53页
techtips8 面向VisualBasic程序员的杂志 第8版.docx_第7页
第7页 / 共53页
techtips8 面向VisualBasic程序员的杂志 第8版.docx_第8页
第8页 / 共53页
techtips8 面向VisualBasic程序员的杂志 第8版.docx_第9页
第9页 / 共53页
techtips8 面向VisualBasic程序员的杂志 第8版.docx_第10页
第10页 / 共53页
亲,该文档总共53页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《techtips8 面向VisualBasic程序员的杂志 第8版.docx》由会员分享,可在线阅读,更多相关《techtips8 面向VisualBasic程序员的杂志 第8版.docx(53页珍藏版)》请在优知文库上搜索。

1、WelcometotheEighthEditionoftheVBPJTechnicalTipsSupplement!ThesetipsandtricksweresubmittedbyprofessionaldevelopersusingVisualBasic3.0,VisualBasic4.0,VisualBasic5.0,VisualBasic6.0,VisualBasicforApplications(VBA),andVisualBasicScript(VBS).TheeditorsatVisualBasicProgrammer,sJournalcompiledthetips.Instea

2、doftypingthecodepublishedhere,downloadthetipsfromthefree,Registered1.evelofTheDevelopmentExchangeat.Ifyou,dliketosubmitatiptoVisualBasicProgrammer,sJournal,pleasesendittoUserTips,FawcetteTechnicalPublications,209HamiltonAve.,PaloAlto,California,USA,94301-2500.Youcanalsofaxitto650-853-0230orsenditele

3、ctronicallytovbpjedit.Pleaseincludeaclearexplanationofwhatthetechniquedoesandwhyit,suseful,andindicateifit,sforVBA,VBS,VB3,VB416-or32-bit,VB5,orVB6.Pleaselimitcodelengthto20lines.Don,tforgettoincludeyoure-mailandmailingaddress.Ifwepublishyourtip,we,llpayyou$25orextendyourVBPJsubscriptionbyoneyear.VB

4、5,VB61.evel:BeginningPreventCheckboxChangesYou,11oftenwanttodisplayacheckbox-stylelistboxtoshowusersthevaluestheyhaveselectedinanunderlyingdatabase.However,youdon,twanttoallowuserstochangetheselections-thatis,tochangewhichboxestheychecked.Youcan,tdisablethelistboxbecausethatstopstheuserfromscrolling

5、thelisttoseewhichitemstheychecked.Youcan,tuse1.ocked,becausethelistboxdoesn,thavea1.ockedproperty.Here,sonesolution:PaintaCommandbuttonwiththecaptionttClicktotoggleenabledproperty,andalistboxonaform,thenchangethelistboxstyleto1-Checkbox.Addthiscode:OptionExplicitDimmbDisabledAsBooleanPrivateSubComma

6、ndl_Click()mbDisabled=NotmbDisabledEndSubPrivateSub1.istl_ltemCheck(ltemAsInteger)IfmbDisabIedThen1.istl-SeIected(Item)=Not1.istl.SeIected(Item)EndIfEndSubWhenmbDisabledissettoTrue,thechangesmadebytheusertothelistboxselectionsareimmediatelyreversed.Itwillappearasiftheselectionshaven,tchangedatall,an

7、dthelistisstillscrollable.IanChamp,receivedbye-mail牟*余字*余*拿木*今*车窄*专*车*车*车窄*余*余*车本*余申*余*拿*拿*余*东*卒*车*余*京字*车*车*余辛*率*多*拿*VB432,VB5,VB61.evel:IntermediateEstablishaDataDictionaryIfyourSQ1.lookslikethis,youneedtoaskyourselfhowmuchcodeyou,dhavetoinspectandreviseifyoudecidedtochangeadatabasefieldortablename

8、,asfrequentlyhappensduringdevelopment:SQ1.String=SE1.ECTfirstname,lastname,&_linepreferences&_FROMimagingusersWHEREusercode=_,&Trim(UCase(UserlDText.Text)&,11ODBCstatus=SQ1.ExecDirect(ODBChandlel,SQ1.String,_1.en(SQ1.String)WhathappensifSQmandconventions(fieldnamedelimiters)change?Becauseacompiledoe

9、sn,trevealsuchnamemisspellingsorconventionflaws,codeinobscureprocedurescanbeinproductionbeforedefectsaredetected.Ourgroupestablishedatableandfielddictionaryinamoduleusedforarecentlargeproject.ThishelpedusensurethatwecorrectlypastedtableandfieldnamesintoallSQmands.Italsoprovidedarepositorythatsimplif

10、iedmaintenance.Asdatabaseresourcenameschangedornewname-delimitingconventionswererequired,werevisedthedictionarybeforerecompiling.Wealsousedthedictionarytoconveydescriptiveinformationabouttablesandfieldstodevelopers.Ourdictionarylookslikethis:tables:PublicConsttblUsersAsString=(imagingusersdatafields

11、:PublicConstfldFirstNameAsString=(firstname16charactersPublicConstfld1.astNameAsString=(lastname16charactersPublicConst(Id1.inePreferencesAsString=_linepreferences20charactersPublicConstfldUserCodeAsString=usercodeIOcharactersOurSQ1.lookslikethis:SQ1.String=SE1.ECT&fldFirstName&_,&fld1.astName&_,&fl

12、d1.inePreferences&_FROM,&tblUsers&_,WHERE&fldUserCode&=&_&Trim(UCase(UserlDTet.Text)&,ODBCstatus=SQ1.ExecDirect(ODBChandlel,SQ1.String,_1.en(SQ1.String)Programmersdonthavetoknowtheactualnamesofdatabasecomponents.Theyalwaysusetheconstantsthatrefertothedatabasecomponents.Acleancompileensuresyou,11usec

13、orrectnamesandname-delimitingconventionsinyourSQ1.statements.DougIIagy,Greensburg,Pennsylvania余*牟申*率*率*牟*辛*牟*拿*本*车申*率*牟*车*拿*拿*率*多*余*牟*牟*辛*专*牟*柴*VB432,VB5,VB61.evel:IntermediateContext-SensitiveHelpforDisabledControlsIfyouwantaformtosupportcontext-sensitivehelp,settheWhatsThisButtonandWhatsThisHeIppr

14、opertiesontheformtoTrue,andsettheWhatsThisHelpIDpropertytoacorrespondinghelp-filetopicIDforanycontrolonthatformforwhichyouwanthelptobedisplayed.Unfortunately,thehelpisn,tshownifthecontrosEnabledpropertyissettoFalse.Tosolvethisproblem,createalabelunderthecontrolwiththesamedimensions,andclearitscaptio

15、ntomakeitinvisible.SettheWhatsThisHelpIDpropertytothesamevalueasthedisabledcontrosproperty.FrankAddati9Melbourne,Australia车*余*辛*车申*车*多*拿车*拿*拿*木*余辛*车*辛*车*车本*余*拿辛*专车*率*余?*拿*车*专*车本*车*拿*拿?*辛*拿*多*车*余本*VB3,VB416/32,VB5,VB61.evel:IntennediateImproveontheBubbleSortAbubblesort,sexecutiontimeisamultipleofthesquareofthenumberofelements.Becauseofthis,thebubblesort

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > IT计算机 > Java

copyright@ 2008-2023 yzwku网站版权所有

经营许可证编号:宁ICP备2022001189号-2

本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!