Сţµç×ÓÊé > ÆäËûµç×ÓÊé > VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ) >

µÚ8ÕÂ

VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ)-µÚ8ÕÂ

С˵£º VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ) ×ÖÊý£º ÿҳ3500×Ö

°´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³£¬°´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ£¬°´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿£¡
¡ª¡ª¡ª¡ªÎ´ÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡




¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡IDE¡¡from¡¡a¡¡CD¡¡instead¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Downloading¡¡Visual¡¡Basic¡¡Express¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡following¡¡is¡¡the¡¡procedure¡¡for¡¡downloading¡¡Visual¡¡Basic¡¡Express¡¡from¡¡the¡¡Microsoft¡¡web¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡site¡£¡¡By¡¡the¡¡time¡¡you¡¡are¡¡reading¡¡this¡¡book£»¡¡the¡¡procedure¡¡may¡¡be¡¡a¡¡bit¡¡different£»¡¡but¡¡it¡¡will¡¡be¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡similar¡¡enough¡¡that¡¡you¡¯ll¡¡be¡¡able¡¡to¡¡find¡¡and¡¡download¡¡the¡¡IDE¡¡package¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡1¡£¡¡¡¡Go¡¡to¡¡http£º//microsoft¡£/express/¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2¡£¡¡¡¡Select¡¡the¡¡Download¡¡Now£¡¡¡link¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡3¡£¡¡¡¡Scroll¡¡down¡¡to¡¡the¡¡Visual¡¡Basic¡¡2008¡¡Express¡¡Edition¡¡section£»¡¡as¡¡shown¡¡in¡¡Figure¡¡1¡­1¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡4¡£¡¡¡¡Click¡¡the¡¡Download¡¡link¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡5¡£¡¡¡¡A¡¡dialog¡¡box¡¡appears£»¡¡asking¡¡where¡¡you¡¡want¡¡to¡¡store¡¡the¡¡downloaded¡¡file¡£¡¡The¡¡file¡¡that¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡you¡¡are¡¡downloading¡¡is¡¡a¡¡small¡¡bootstrap¡¡file£»¡¡which¡¡you¡¯ll¡¡use¡¡to¡¡begin¡¡the¡¡actual¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡installation¡¡of¡¡the¡¡Visual¡¡Basic¡¡Express¡¡IDE¡£¡¡Choose¡¡to¡¡save¡¡the¡¡file¡¡on¡¡the¡¡desktop¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡These¡¡steps¡¡can¡¡be¡¡carried¡¡out¡¡very¡¡quickly¡ªprobably¡¡within¡¡a¡¡few¡¡minutes¡£¡¡Do¡¡not¡¡mistake¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡this¡¡procedure¡¡for¡¡downloading¡¡the¡¡plete¡¡Visual¡¡Basic¡¡Express¡¡application£»¡¡because¡¡that¡¯s¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡not¡¡what¡¡happened¡£¡¡The¡¡installation¡¡procedure¡¡will¡¡download¡¡the¡¡vast¡¡majority¡¡of¡¡the¡¡IDE¡£¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡25¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡C¡¡H¡¡AP¡¡TE¡¡R¡¡¡¡¡¡1¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡R¡¡E¡¡AD¡¡Y¡¡£»¡¡¡¡¡¡ST¡¡E¡¡AD¡¡Y¡¡£»¡¡¡¡¡¡G¡¡O£¡¡¡3¡¡



Figure¡¡1¡­1¡£¡¡Selecting¡¡Visual¡¡Basic¡¡2008¡¡Express¡¡Edition¡¡



Installing¡¡Visual¡¡Basic¡¡Express¡¡



After¡¡you¡¯ve¡¡downloaded¡¡the¡¡setup¡¡file£»¡¡you¡¡can¡¡start¡¡the¡¡Visual¡¡Basic¡¡Express¡¡installation¡£¡¡¡¡

During¡¡this¡¡process£»¡¡all¡¡the¡¡pieces¡¡of¡¡the¡¡IDE¡ªabout¡¡300MB¡ªare¡¡downloaded¡¡and¡¡installed¡£¡¡¡¡

Follow¡¡these¡¡steps£º¡¡



¡¡¡¡¡¡¡¡¡¡1¡£¡¡¡¡On¡¡your¡¡desktop£»¡¡double¡­click¡¡the¡¡vbsetup¡£exe¡¡file¡£¡¡Wait¡¡while¡¡the¡¡setup¡¡program¡¡loads¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡all¡¡the¡¡required¡¡ponents¡£¡¡



¡¡¡¡¡¡¡¡¡¡2¡£¡¡¡¡Click¡¡Next¡¡on¡¡the¡¡initial¡¡setup¡¡screen¡£¡¡



¡¡¡¡¡¡¡¡¡¡3¡£¡¡¡¡A¡¡series¡¡of¡¡dialog¡¡boxes¡¡will¡¡appear¡£¡¡Select¡¡the¡¡defaults¡¡and¡¡click¡¡Next¡¡to¡¡continue¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡through¡¡the¡¡setup¡¡program¡£¡¡In¡¡the¡¡final¡¡dialog¡¡box£»¡¡click¡¡Install¡£¡¡¡¡



¡¡¡¡¡¡¡¡¡¡4¡£¡¡¡¡After¡¡all¡¡the¡¡elements¡¡have¡¡been¡¡downloaded¡¡and¡¡installed£»¡¡you¡¡may¡¡need¡¡to¡¡restart¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡your¡¡puter¡£¡¡



¡¡¡¡¡¡¡¡¡¡After¡¡Visual¡¡Basic¡¡Express¡¡is¡¡installed£»¡¡you¡¡can¡¡start¡¡it¡¡by¡¡selecting¡¡it¡¡from¡¡the¡¡Start¡¡menu¡£¡¡



Choosing¡¡the¡¡Application¡¡Type¡¡



With¡¡Visual¡¡Basic¡¡Express¡¡running£»¡¡you¡¯re¡¡ready¡¡to¡¡write¡¡your¡¡first¡¡¡¡application¡£¡¡However£»¡¡¡¡

first¡¡you¡¡need¡¡to¡¡make¡¡a¡¡choice£º¡¡what¡¡type¡¡of¡¡application¡¡will¡¡you¡¡write£¿¡¡Broadly¡¡speaking£»¡¡in¡¡¡¡

£»¡¡you¡¡can¡¡develop¡¡three¡¡main¡¡types¡¡of¡¡programs£º¡¡¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡26¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

4¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡AP¡¡T¡¡E¡¡R¡¡¡¡¡¡1¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡R¡¡E¡¡A¡¡DY¡¡£»¡¡¡¡¡¡ST¡¡E¡¡A¡¡DY¡¡£»¡¡¡¡¡¡G¡¡O¡¡£¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡o¡¡¡¡A¡¡console¡¡application¡¡is¡¡designed¡¡to¡¡run¡¡at¡¡the¡¡mand¡¡line¡¡with¡¡no¡¡graphical¡¡user¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡interface¡¡£¨GUI£©¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡o¡¡¡¡A¡¡¡¡Windows¡¡application¡¡is¡¡designed¡¡to¡¡run¡¡on¡¡a¡¡user¡¯s¡¡desktop¡¡and¡¡has¡¡a¡¡GUI¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡o¡¡¡¡A¡¡class¡¡library¡¡holds¡¡reusable¡¡functionality¡¡that¡¡can¡¡be¡¡used¡¡by¡¡console¡¡and¡¡Windows¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡applications¡£¡¡It¡¡cannot¡¡be¡¡run¡¡by¡¡itself¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡So¡¡that¡¡you¡¡know¡¡what¡¡each¡¡type¡¡of¡¡program¡¡is¡¡about£»¡¡in¡¡this¡¡chapter£»¡¡you¡¡will¡¡code¡¡all¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡three¡£¡¡They¡¡are¡¡all¡¡variations¡¡of¡¡the¡¡Hello£»¡¡World¡¡example£»¡¡which¡¡displays¡¡the¡¡text¡¡¡°hello£»¡¡world¡±¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡on¡¡the¡¡screen¡£¡¡Hello£»¡¡World¡¡programs¡¡have¡¡been¡¡used¡¡for¡¡decades¡¡to¡¡demonstrate¡¡program

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ming¡¡languages¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Creating¡¡Projects¡¡and¡¡Solutions¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Regardless¡¡of¡¡which¡¡program¡¡type¡¡you¡¡are¡¡going¡¡to¡¡code£»¡¡when¡¡using¡¡the¡¡Visual¡¡Studio¡¡line¡¡of¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡products£»¡¡you¡¡will¡¡create¡¡projects¡¡and¡¡solutions£º¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡o¡¡¡¡A¡¡project¡¡is¡¡a¡¡classification¡¡used¡¡to¡¡describe¡¡a¡¡type¡¡of¡¡¡¡application¡£¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡o¡¡¡¡A¡¡solution¡¡is¡¡a¡¡classification¡¡used¡¡to¡¡describe¡¡multiple¡¡¡¡applications¡¡that¡¡most¡¡likely¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡relate¡¡to¡¡each¡¡other¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Imagine¡¡building¡¡a¡¡car¡£¡¡A¡¡project¡¡could¡¡be¡¡the¡¡steering¡¡wheel£»¡¡engine£»¡¡or¡¡car¡¡body¡£¡¡Putting¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡all¡¡of¡¡the¡¡car¡¡projects¡¡together¡¡creates¡¡a¡¡plete¡¡solution¡¡called¡¡the¡¡car¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡A¡¡solution¡¡contains¡¡projects¡£¡¡For¡¡the¡¡examples¡¡in¡¡this¡¡chapter£»¡¡our¡¡solution¡¡will¡¡contain¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡three¡¡projects¡¡representing¡¡each¡¡of¡¡the¡¡three¡¡different¡¡program¡¡types¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡When¡¡using¡¡Visual¡¡Basic¡¡Express£»¡¡creating¡¡a¡¡project¡¡implies¡¡creating¡¡a¡¡solution£»¡¡because¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡creating¡¡an¡¡empty¡¡solution¡¡without¡¡a¡¡project¡¡does¡¡not¡¡make¡¡sense¡£¡¡It¡¯s¡¡like¡¡building¡¡a¡¡car¡¡with¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡no¡¡parts¡£¡¡When¡¡I¡¡say¡¡¡°project¡±¡¡or¡¡¡°application¡±¡¡in¡¡this¡¡book£»¡¡from¡¡a¡¡workspace¡¡organization¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡perspective£»¡¡it¡¡means¡¡the¡¡same¡¡thing¡£¡¡Solution¡¡is¡¡an¡¡explicit¡¡reference¡¡to¡¡one¡¡or¡¡more¡¡projects¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡or¡¡applications¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Our¡¡plan¡¡of¡¡action¡¡in¡¡terms¡¡of¡¡projects¡¡and¡¡solutions¡¡in¡¡this¡¡chapter¡¡is¡¡as¡¡follows£º¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Create¡¡the¡¡¡¡solution¡¡by¡¡creating¡¡a¡¡Windows¡¡application¡¡called¡¡WindowsApplication¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¨creating¡¡this¡¡application¡¡also¡¡creates¡¡a¡¡solution£©¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Add¡¡to¡¡the¡¡created¡¡solution¡¡a¡¡console¡¡application¡¡called¡¡ConsoleApplication¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡o¡¡¡¡Add¡¡to¡¡the¡¡created¡¡solution¡¡a¡¡class¡¡library¡¡project¡¡called¡¡ClassLibrary¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Creating¡¡the¡¡Windows¡¡Application¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡We¡¯ll¡¡dive¡¡right¡¡in¡¡and¡¡start¡¡with¡¡the¡¡Windows¡¡application¡£¡¡With¡¡Visual¡¡Basic¡¡Express¡¡running£»¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡follow¡¡these¡¡steps¡¡to¡¡create¡¡the¡¡Windows¡¡application£º¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡1¡£¡¡¡¡Select¡¡File¡¡¡¡New¡¡Project¡¡from¡¡the¡¡menu¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2¡£¡¡¡¡Select¡¡the¡¡Windows¡¡Forms¡¡Application¡¡icon¡£¡¡This¡¡represents¡¡a¡¡project¡¡style¡¡based¡¡on¡¡a¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡predefined¡¡template¡¡called¡¡Windows¡¡Forms¡¡Application¡£¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡27¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡C¡¡H¡¡AP¡¡TE¡¡R¡¡¡¡¡¡1¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡R¡¡E¡¡AD¡¡Y¡¡£»¡¡¡¡¡¡ST¡¡E¡¡AD¡¡Y¡¡£»¡¡¡¡¡¡G¡¡O£¡¡¡5¡¡



¡¡¡¡¡¡¡¡¡¡¡¡3¡£¡¡Change¡¡the¡¡default¡¡name¡¡to¡¡WindowsApplication¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡4¡£¡¡Click¡¡OK¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡These¡¡steps¡¡create¡¡a¡¡new¡¡project¡¡and¡¡solution¡¡at¡¡the¡¡same¡¡time£º¡¡Visual¡¡Basic¡¡Express¡¡will¡¡¡¡

display¡¡only¡¡the¡¡plete¡¡project£»¡¡as¡¡shown¡¡in¡¡Figure¡¡1¡­2¡£¡¡



Figure¡¡1¡­2¡£¡¡¡¡The¡¡Visual¡¡Basic¡¡Express¡¡IDE¡¡with¡¡the¡¡new¡¡WindowsApplication¡¡project¡¡



Viewing¡¡the¡¡Source¡¡Code¡¡



When¡¡you¡¡create¡¡a¡¡new¡¡application£»¡¡Visual¡¡Basic¡¡Express¡¡automatically¡¡generates¡¡some¡¡source¡¡¡¡

code¡¡for¡¡it¡£¡¡Right¡­click¡¡the¡¡Form1¡£vb¡¡item¡¡in¡¡the¡¡Solution¡¡Explorer¡¡and¡¡select¡¡View¡¡Code¡¡from¡¡¡¡

the¡¡context¡¡menu¡£¡¡The¡¡following¡¡source¡¡code¡¡will¡¡appear¡¡in¡¡the¡¡area¡¡to¡¡the¡¡left¡¡of¡¡the¡¡Solution¡¡¡¡

Explorer¡£¡¡



¡öNote¡¡¡¡To¡¡shift¡¡between¡¡the¡¡user¡¡interface¡¡and¡¡generated¡¡code£»¡¡right¡­click¡¡Form1¡£vb¡¡in¡¡the¡¡Solution¡¡Explorer¡£¡¡A¡¡¡¡

submenu¡¡appears¡¡with¡¡the¡¡options¡¡View¡¡Code¡¡£¨to¡¡see¡¡the¡¡code£©¡¡or¡¡View¡¡Designer¡¡£¨to¡¡see¡¡the¡¡user¡¡interface£©¡£¡¡



Public¡¡Class¡¡Form1¡¡



End¡¡Class¡¡



¡¡¡¡¡¡¡¡¡¡¡¡In¡¡Visual¡¡Basic£»¡¡the¡¡source¡¡code¡¡is¡¡spartan¡¡because¡¡Visual¡¡Basic¡¡is¡¡what¡¡was¡¡once¡¡called¡¡a¡¡¡¡

rapid¡¡application¡¡development¡¡£¨RAD£©¡¡environment¡£¡¡The¡¡idea¡¡at¡¡the¡¡core¡¡of¡¡Visual¡¡Basic¡¡is¡¡the¡¡¡¡

ability¡¡to¡¡develop¡¡an¡¡application¡¡as¡¡quickly¡¡as¡¡possible¡¡without¡¡the¡¡esoteric¡¡details¡¡of¡¡the¡¡language¡¡¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡28¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

6¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡AP¡¡T¡¡E¡¡R¡¡¡¡¡¡1¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡R¡¡E¡¡A¡¡DY¡¡£»¡¡¡¡¡¡ST¡¡E¡¡A¡¡DY¡¡£»¡¡¡¡¡¡G¡¡O¡¡£¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡getting¡¡in¡¡your¡¡way¡£¡¡This¡¡legacy¡¡is¡¡both¡¡good¡¡and¡¡bad¡£¡¡Figure¡¡1¡­2¡¡shows¡¡a¡¡simple¡¡project¡¡with¡¡a¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡single¡¡file£»¡¡but¡¡another¡¡file¡¡exists¡¡at¡¡the¡¡hard¡¡disk¡¡level£»¡¡as¡¡shown¡¡in¡¡Figure¡¡1¡­3¡¡£¨you¡¡can¡¡see¡¡this¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡file¡¡by¡¡clicking¡¡the¡¡Show¡¡All¡¡Files¡¡icon¡¡in¡¡the¡¡Solution¡¡Explorer¡¡and¡¡expanding¡¡the¡¡Form1¡£vb¡¡node£©¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Figure¡¡1¡­3¡£¡¡All¡¡files¡¡that¡¡make¡¡up¡¡the¡¡WindowsApplication¡¡project¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡In¡¡previous¡¡versions£»¡¡the¡¡Form1¡£Designer¡£vb¡¡file¡¡used¡¡to¡¡be¡¡a¡¡binary¡¡file¡¡that¡¡you¡¡could¡¡not¡¡edit¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Now¡¡it¡¡is¡¡a¡¡text¡¡file¡¡that¡¡you¡¡can¡¡edit£»¡¡but¡¡you¡¡should

·µ»ØĿ¼ ÉÏÒ»Ò³ ÏÂÒ»Ò³ »Øµ½¶¥²¿ ÔÞ£¨2£© ²È£¨2£©

Äã¿ÉÄÜϲ»¶µÄ