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

µÚ10ÕÂ

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

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

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




¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡To¡¡make¡¡the¡¡application¡¡do¡¡something£»¡¡you¡¡need¡¡to¡¡think¡¡in¡¡terms¡¡of¡¡events¡£¡¡For¡¡example£»¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡if¡¡you¡¡have¡¡a¡¡garage¡¡with¡¡an¡¡automatic¡¡door¡¡opener£»¡¡you¡¡would¡¡expect¡¡that¡¡pressing¡¡the¡¡remote¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡control¡¡button¡¡would¡¡open¡¡the¡¡garage¡¡door¡¡when¡¡it¡¯s¡¡closed¡¡and¡¡close¡¡the¡¡door¡¡when¡¡it¡¯s¡¡open¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡automatic¡¡garage¡¡door¡¡manufacturer¡¡associated¡¡the¡¡event¡¡of¡¡pushing¡¡the¡¡remote¡¡control¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡button¡¡with¡¡the¡¡action¡¡of¡¡either¡¡opening¡¡or¡¡closing¡¡the¡¡garage¡¡door¡£¡¡In¡¡WindowsApplication£»¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡we¡¯ll¡¡associate¡¡the¡¡clicking¡¡of¡¡the¡¡button¡¡with¡¡the¡¡action¡¡of¡¡showing¡¡text¡¡in¡¡the¡¡text¡¡box¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Select¡¡the¡¡button¡¡on¡¡the¡¡form¡¡in¡¡Visual¡¡Basic¡¡Express¡¡and¡¡double¡­click¡¡it¡£¡¡The¡¡work¡¡area¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡changes¡¡to¡¡source¡¡code£»¡¡with¡¡the¡¡cursor¡¡in¡¡the¡¡Button1_Click£¨£©¡¡function¡£¡¡Add¡¡this¡¡source¡¡code¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡to¡¡the¡¡function£º¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡TextBox1¡£text¡¡=¡¡¡¨hello£»¡¡world¡¨¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Figure¡¡1¡­7¡¡illustrates¡¡the¡¡procedure¡¡for¡¡associating¡¡an¡¡event¡¡with¡¡an¡¡action¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Figure¡¡1¡­7¡£¡¡Associating¡¡the¡¡button¡¡click¡¡event¡¡with¡¡the¡¡¡¡action¡¡of¡¡adding¡¡text¡¡to¡¡the¡¡text¡¡box¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Note¡¡that¡¡TextBox1¡¡is¡¡the¡¡name¡¡of¡¡the¡¡text¡¡box¡¡you¡¡added¡¡to¡¡the¡¡form¡£¡¡This¡¡name¡¡is¡¡gener

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ated¡¡by¡¡Visual¡¡Basic¡¡Express£»¡¡just¡¡as¡¡it¡¡generated¡¡a¡¡default¡¡name¡¡for¡¡the¡¡button¡£¡¡You¡¡can¡¡change¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡the¡¡default¡¡names¡¡£¨through¡¡each¡¡control¡¯s¡¡Properties¡¡window£©£»¡¡but¡¡we¡¯ve¡¡left¡¡the¡¡default¡¡for¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡this¡¡example¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Adding¡¡an¡¡action¡¡to¡¡an¡¡event¡¡is¡¡very¡¡simple¡¡when¡¡following¡¡the¡¡instructions¡¡shown¡¡in¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Figure¡¡1¡­7¡£¡¡The¡¡simplicity¡¡is¡¡due¡¡to¡¡Visual¡¡Basic¡¡Express£»¡¡and¡¡not¡¡because¡¡the¡¡event¡¡or¡¡action¡¡is¡¡¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡33¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

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



simple¡£¡¡Visual¡¡Basic¡¡Express¡¡makes¡¡the¡¡assumption¡¡that¡¡when¡¡you¡¡double¡­click¡¡a¡¡control£»¡¡you¡¡¡¡

want¡¡to¡¡modify¡¡the¡¡¡¡default¡¡event¡¡of¡¡the¡¡control£»¡¡and¡¡as¡¡such£»¡¡automatically¡¡generates¡¡the¡¡code¡¡¡¡

in¡¡step¡¡3¡¡of¡¡Figure¡¡1¡­7¡£¡¡In¡¡the¡¡case¡¡of¡¡a¡¡button£»¡¡the¡¡default¡¡event¡¡is¡¡the¡¡click¡¡event£»¡¡that¡¡is£»¡¡the¡¡¡¡

event¡¡that¡¡corresponds¡¡to¡¡a¡¡user¡¡clicking¡¡the¡¡button¡£¡¡The¡¡assumption¡¡of¡¡the¡¡click¡¡event¡¡being¡¡¡¡

the¡¡default¡¡event¡¡for¡¡a¡¡button¡¡is¡¡logical¡£¡¡Other¡¡controls¡¡have¡¡different¡¡default¡¡events¡£¡¡For¡¡example£»¡¡¡¡

double¡­clicking¡¡a¡¡TextBox¡¡control¡¡will¡¡generate¡¡the¡¡code¡¡for¡¡the¡¡text¡­changed¡¡event¡£¡¡

¡¡¡¡¡¡¡¡¡¡Run¡¡the¡¡application¡¡by¡¡pressing¡¡Ctrl£«F5£»¡¡and¡¡then¡¡click¡¡the¡¡button¡£¡¡The¡¡text¡¡box¡¡fills¡¡with¡¡¡¡

the¡¡text¡¡¡°hello£»¡¡world¡£¡±¡¡Congratulations£»¡¡you¡¯ve¡¡just¡¡finished¡¡your¡¡first¡¡Visual¡¡Basic¡¡application¡£¡¡

¡¡¡¡¡¡¡¡¡¡You¡¡have¡¡associated¡¡an¡¡event¡¡with¡¡an¡¡action£º¡¡the¡¡button¡¡click¡¡with¡¡the¡¡text¡¡display¡£¡¡Associ

ating¡¡events¡¡with¡¡actions¡¡is¡¡the¡¡basis¡¡of¡¡all¡¡Windows¡¡applications¡£¡¡¡¡



Adding¡¡ments¡¡to¡¡the¡¡Application¡¡



Now¡¡that¡¡you¡¡have¡¡a¡¡working¡¡program£»¡¡it¡¡would¡¡be¡¡good¡¡to¡¡document¡¡what¡¡it¡¡does£»¡¡right¡¡there¡¡¡¡

in¡¡the¡¡source¡¡code¡£¡¡Then¡¡if¡¡you¡¡e¡¡back¡¡to¡¡the¡¡application¡¡in¡¡the¡¡future£»¡¡you¡¡won¡¯t¡¡be¡¡puzzled¡¡¡¡

by¡¡your¡¡previous¡¡work¡£¡¡In¡¡fact£»¡¡you¡¡may¡¡not¡¡even¡¡be¡¡the¡¡person¡¡who¡¡maintains¡¡your¡¡code£»¡¡so¡¡¡¡

leaving¡¡ments¡¡in¡¡the¡¡code¡¡to¡¡help¡¡explain¡¡it¡¡is¡¡definitely¡¡good¡¡practice¡£¡¡Even¡¡if¡¡you¡¡know¡¡¡¡

you¡¡will¡¡be¡¡maintaining¡¡the¡¡code¡¡forever£»¡¡treat¡¡your¡¡future¡¡self¡¡as¡¡a¡¡stranger¡£¡¡You¡¡may¡¡be¡¡surprised¡¡¡¡

how¡¡long¡¡it¡¡takes¡¡to¡¡decipher¡¡code¡¡you¡¡have¡¡written¡¡when¡¡revisited¡¡months¡¡or¡¡years¡¡later¡£¡¡

¡¡¡¡¡¡¡¡¡¡To¡¡add¡¡a¡¡single¡­line¡¡ment£»¡¡use¡¡the¡¡following¡¡syntax£º¡¡



¡¡'¡¡A¡¡single¡­line¡¡ment¡¡



¡¡¡¡¡¡¡¡¡¡Anything¡¡after¡¡the¡¡¡¡'¡¡on¡¡the¡¡same¡¡line¡¡is¡¡ignored¡¡by¡¡the¡¡piler¡¡and¡¡is¡¡not¡¡included¡¡in¡¡the¡¡¡¡

final¡¡application¡£¡¡Let¡¯s¡¡document¡¡our¡¡Windows¡¡application£º¡¡



¡¡'¡¡When¡¡the¡¡user¡¡clicks¡¡the¡¡button£»¡¡we¡¡display¡¡text¡¡in¡¡the¡¡text¡¡box¡¡

¡¡¡¡¡¡¡¡Private¡¡Sub¡¡Button1_Click£¨ByVal¡¡sender¡¡As¡¡System¡£Object£»¡¡¡¡

ByVal¡¡e¡¡As¡¡System¡£EventArgs£©¡¡Handles¡¡Button1¡£Click¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡TextBox1¡£Text¡¡=¡¡¡¨hello£»¡¡world¡¨¡¡

¡¡¡¡¡¡¡¡End¡¡Sub¡¡



¡¡¡¡¡¡¡¡¡¡The¡¡Visual¡¡Basic¡¡language¡¡is¡¡a¡¡single¡­line¡¡language¡£¡¡This¡¡means¡¡that¡¡a¡¡statement¡¡must¡¡be¡¡¡¡

part¡¡of¡¡a¡¡single¡¡line¡£¡¡Let¡¯s¡¡look¡¡at¡¡a¡¡single¡¡statement£º¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡TextBox1¡£Text¡¡=¡¡¡¨hello£»¡¡world¡¨¡¡



¡¡¡¡¡¡¡¡¡¡This¡¡line¡¡of¡¡code¡¡is¡¡a¡¡single¡¡statement¡¡because¡¡it¡¡is¡¡considered¡¡an¡¡assignment¡¡of¡¡one¡¡variable¡¡¡¡

by¡¡another¡¡piece¡¡of¡¡source¡¡code¡£¡¡You¡¡could¡¡not¡¡write¡¡the¡¡statement¡¡as¡¡follows£º¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡TextBox1¡£Text¡¡=¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¨hello£»¡¡world¡¨¡¡



¡¡¡¡¡¡¡¡¡¡When¡¡the¡¡statement¡¡is¡¡broken¡¡into¡¡two¡¡lines¡¡of¡¡source¡¡code£»¡¡the¡¡Visual¡¡Basic¡¡piler¡¡sees¡¡¡¡

it¡¡as¡¡two¡¡statements¡£¡¡Since¡¡those¡¡two¡¡statements¡¡are¡¡not¡¡plete£»¡¡a¡¡pilation¡¡error¡¡will¡¡¡¡

result¡£¡¡If¡¡you¡¡need¡¡to¡¡break¡¡a¡¡single¡¡statement¡¡over¡¡two¡¡lines£»¡¡you¡¡must¡¡let¡¡the¡¡piler¡¡know¡¡¡¡

by¡¡adding¡¡the¡¡line¡­continuation¡¡character¡ªan¡¡underscore¡¡£¨_£©¡ªat¡¡the¡¡end¡¡of¡¡the¡¡continued¡¡¡¡

code£»¡¡as¡¡follows£º¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡TextBox1¡£Text¡¡=¡¡_¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¨hello£»¡¡world¡¨¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡34¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

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



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Navigating¡¡the¡¡User¡¡Controls¡¡of¡¡the¡¡Solution¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡When¡¡you¡¡are¡¡writing¡¡your¡¡code£»¡¡your¡¡most¡¡important¡¡form¡¡of¡¡navigation¡¡is¡¡the¡¡Solution¡¡Explorer¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡Solution¡¡Explorer¡¡is¡¡the¡¡tree¡¡control¡¡that¡¡contains¡¡the¡¡references¡¡to¡¡your¡¡solutions¡¡and¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡projects¡£¡¡Consider¡¡the¡¡Solution¡¡Explorer¡¡as¡¡your¡¡developer¡¡dashboard£»¡¡which¡¡you¡¡can¡¡use¡¡to¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡fine¡­tune¡¡how¡¡your¡¡¡¡application¡¡is¡¡assembled¡¡and¡¡executed¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡I¡¡suggest¡¡that¡¡you¡¡take¡¡a¡¡moment¡¡to¡¡click¡¡around¡¡the¡¡Solution¡¡Explorer¡£¡¡Try¡¡some¡¡right

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡clicks¡¡on¡¡various¡¡elements¡£¡¡The¡¡context¡­sensitive¡¡click¡¡is¡¡a¡¡fast¡¡way¡¡of¡¡fine¡­tuning¡¡particular¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡aspects¡¡of¡¡your¡¡solution¡¡and¡¡project¡£¡¡However£»¡¡when¡¡clicking£»¡¡please¡¡do¡¡not¡¡click¡¡OK¡¡in¡¡any¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡dialog¡¡box£»¡¡for¡¡now£»¡¡click¡¡Cancel¡¡so¡¡that¡¡any¡¡changes¡¡you¡¡may¡¡have¡¡made¡¡are¡¡not¡¡saved¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡To¡¡the¡¡right¡¡of¡¡the¡¡Solution¡¡Explorer¡¡is¡¡your¡¡work¡¡area¡£¡¡The¡¡work¡¡area¡¡is¡¡where¡¡you¡¡write¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡your¡¡code¡¡or¡¡edit¡¡your¡¡user¡¡interface¡£¡¡The¡¡work¡¡area¡¡will¡¡display¡¡only¡¡a¡¡single¡¡piece¡¡of¡¡informa

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡tion£»¡¡which¡¡could¡¡be¡¡some¡¡code£»¡¡a¡¡user¡¡interface£»¡¡or¡¡a¡¡project¡£¡¡As¡¡you¡¡saw¡¡earlier£»¡¡when¡¡you¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡double¡­click¡¡Form1¡£vb¡¡in¡¡the¡¡Solution¡¡Explorer£»¡¡the¡¡work¡¡area¡¡displays¡¡the¡¡form¡¡related¡¡to¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Form1¡£vb¡¡file¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Now¡¡that¡¡you¡¡have¡¡an¡¡idea¡¡of¡¡how¡¡the¡¡IDE¡¡works£»¡¡let¡¯s¡¡continue¡¡with¡¡our¡¡examples¡£¡¡Next¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡up¡¡is¡¡the¡¡console¡¡application¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Creating¡¡the¡¡Console¡¡Application¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡A¡¡console¡¡application¡¡is¡¡a¡¡text¡­based¡¡application¡£¡¡This¡¡means¡¡that¡¡rather¡¡than¡¡displaying¡¡a¡¡GUI£»¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡it¡¡uses¡¡a¡¡mand¡­line¡¡interface¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡console¡¡has¡¡a¡¡very¡¡long¡¡history¡¡because¡¡the¡¡console¡¡was¡¡the¡¡first¡¡way¡¡to¡¡interact¡¡with¡¡a¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡puter¡£¡¡Consoles¡¡are¡¡not¡¡very¡¡user¡­friendly¡¡and¡¡bee¡¡very¡¡tedious¡¡for¡¡any¡¡plex¡¡oper

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ations£»¡¡yet¡¡some¡¡people¡¡claim¡¡that¡¡a¡¡console¡¡is¡¡all¡¡you¡¡need¡£¡¡£¨See¡¡http£º//en¡£wikipedia¡£org/¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡wiki/mand_line_interface¡¡for¡¡more¡¡information¡¡about¡¡the¡¡console¡££©¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Writing¡¡to¡¡the¡¡console¡¡works¡¡only¡¡if¡¡the¡¡currently¡¡running¡¡application¡¡has¡¡a¡¡console¡£¡¡To¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡open¡¡the¡¡console¡¡in¡¡Windows£»¡¡select¡¡Start¡¡¡¡Run¡¡and¡¡type¡¡cmd¡¡in¡¡the¡¡dialog¡¡box¡£¡¡When¡¡you¡¡test¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡a¡¡console¡¡application£»¡¡Visual¡¡Basic¡¡Express¡¡opens¡¡a¡¡console¡¡for¡¡you¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Visual¡¡Basic¡¡Express¡¡can¡¡create£»¡¡build£»¡¡and¡¡manage¡¡console¡¡applications¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Adding¡¡a¡¡Console¡¡Application¡¡Project¡¡to¡¡the¡¡Solution¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡We¡¡will¡¡now¡¡create¡¡an¡¡application¡¡that¡¡outputs¡¡the¡¡text¡¡¡°hello£»¡¡world¡±¡¡to¡¡the¡¡console¡£¡¡Follow¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡these¡¡steps¡¡to¡¡add¡¡the¡¡new¡¡project¡¡to¡¡the¡¡ThreeExamples¡¡solution£º¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡1¡£¡¡Choose¡¡File¡¡¡¡Add¡¡¡¡New¡¡Project¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2¡£¡¡Make¡¡sure¡¡the¡¡location¡¡is¡¡the¡¡same¡¡as¡¡that¡¡of¡¡WindowsApplication¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡3¡£¡¡Select¡¡Console¡¡Application¡¡and¡¡change¡¡the¡¡name¡¡to¡¡ConsoleApplication¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡Solution¡¡Explorer¡¡changes¡¡to¡¡show¡¡the¡¡additional¡¡project¡¡and¡¡now

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

Äã¿ÉÄÜϲ»¶µÄ