ÓÑÇéÌáʾ£ºÈç¹û±¾ÍøÒ³´ò¿ªÌ«Âý»òÏÔʾ²»ÍêÕû£¬Çë³¢ÊÔÊó±êÓÒ¼ü¡°Ë¢Ð¡±±¾ÍøÒ³£¡
VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ)-µÚ4²¿·Ö
¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·ҳ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿! Èç¹û±¾ÊéûÓÐÔĶÁÍ꣬ÏëÏ´μÌÐø½Ó×ÅÔĶÁ£¬¿ÉʹÓÃÉÏ·½ "Êղص½ÎÒµÄä¯ÀÀÆ÷" ¹¦ÄÜ ºÍ "¼ÓÈëÊéÇ©" ¹¦ÄÜ£¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Using¡¡the¡¡Type¡¡Constraint¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡423¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Using¡¡the¡¡New¡¡Constraint¡¡¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡425¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Using¡¡the¡¡Class¡¡Constraint¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡425¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Nullable¡¡Types¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡426¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Partial¡¡Classes¡¡and¡¡Methods¡¡¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡427¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡Important¡¡Stuff¡¡to¡¡Remember¡¡¡¡¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡430¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Some¡¡Things¡¡for¡¡You¡¡to¡¡Do¡¡¡¡¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡431¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡öINDEX¡¡¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡¡£¡¡433¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡17¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
About¡¡the¡¡Author¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Many¡¡people¡¡say¡¡that¡¡by¡¡looking¡¡at¡¡a¡¡person¡¯s¡¡dog£»¡¡you¡¡can¡¡tell¡¡what¡¡the¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡person¡¡is¡¡like¡£¡¡Well£»¡¡the¡¡picture¡¡is¡¡of¡¡my¡¡dog¡¡Louys£»¡¡an¡¡English¡¡bulldog¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡And¡¡yes£»¡¡my¡¡English¡¡bulldog¡¡and¡¡I¡¡have¡¡many¡¡mon¡¡characteristics¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡But¡¡what¡¡about¡¡the¡¡biography¡¡of¡¡the¡¡author£»¡¡CHRISTIAN¡¡GROSS£¿¡¡It¡¯s¡¡pretty¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡simple£º¡¡I¡¯m¡¡a¡¡guy¡¡who¡¡has¡¡spent¡¡oodles¡¡of¡¡time¡¡strapped¡¡to¡¡a¡¡chair¡¡debugging¡¡¡¡
and¡¡taking¡¡apart¡¡code¡£¡¡In¡¡fact£»¡¡I¡¡really¡¡enjoy¡¡this¡¡business¡¡we¡¡call¡¡software¡¡development¡£¡¡I¡¡have¡¡¡¡
loved¡¡it¡¡ever¡¡since¡¡I¡¡learned¡¡how¡¡to¡¡peek¡¡and¡¡poke¡¡my¡¡first¡¡bytes¡£¡¡I¡¡have¡¡written¡¡various¡¡books£»¡¡¡¡
including¡¡Ajax¡¡and¡¡REST¡¡Recipes£º¡¡A¡¡Problem¡Solution¡¡Approach£»¡¡Foundations¡¡of¡¡Object¡Oriented¡¡¡¡
Programming¡¡Using¡¡¡¡2¡£0¡¡Patterns£»¡¡A¡¡Programmer's¡¡Introduction¡¡to¡¡Windows¡¡DNA¡¡£»¡¡and¡¡¡¡
Beginning¡¡C#£º¡¡From¡¡Novice¡¡to¡¡Professional£»¡¡all¡¡available¡¡from¡¡Apress¡£¡¡
¡¡¡¡¡¡¡¡¡¡These¡¡days£»¡¡I¡¡enjoy¡¡coding¡¡and¡¡experimenting¡¡with¡¡£»¡¡as¡¡it¡¡is¡¡a¡¡fascinating¡¡environment¡£¡¡¡¡
¡¡makes¡¡me¡¡feel¡¡like¡¡a¡¡kid¡¡opening¡¡a¡¡present¡¡on¡¡Christmas¡¡morning¡£¡¡You¡¡had¡¡an¡¡idea¡¡what¡¡¡¡
the¡¡gift¡¡was£»¡¡but¡¡you¡¡were¡¡not¡¡pletely¡¡sure¡£¡¡And¡¡with¡¡£»¡¡there¡¡is¡¡no¡¡relative¡¡giving¡¡you¡¡¡¡
socks¡¡or¡¡a¡¡sweater¡£¡¡It¡¯s¡¡excitement¡¡all¡¡the¡¡way£¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡xv¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡18¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡19¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
About¡¡the¡¡Technical¡¡Reviewer¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡öANDY¡¡OLSEN¡¡is¡¡a¡¡freelance¡¡developer¡¡and¡¡consultant¡¡based¡¡in¡¡the¡¡UK¡£¡¡Andy¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡has¡¡been¡¡working¡¡with¡¡¡¡since¡¡beta¡¡1¡¡days£»¡¡and¡¡has¡¡coauthored¡¡and¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡reviewed¡¡several¡¡books¡¡for¡¡Apress£»¡¡covering¡¡C#£»¡¡Visual¡¡Basic£»¡¡ASP£»¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡and¡¡other¡¡topics¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Andy¡¡is¡¡a¡¡keen¡¡football¡¡and¡¡rugby¡¡fan£»¡¡and¡¡enjoys¡¡running¡¡and¡¡skiing¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¨badly£©¡£¡¡He¡¡lives¡¡by¡¡the¡¡seaside¡¡in¡¡Swansea¡¡with¡¡his¡¡wife£»¡¡Jayne£»¡¡and¡¡children£»¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Emily¡¡and¡¡Thomas£»¡¡who¡¡have¡¡just¡¡discovered¡¡the¡¡thrills¡¡of¡¡surfing¡¡and¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡look¡¡much¡¡cooler¡¡than¡¡he¡¡ever¡¡will£¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡xvii¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡20¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡21¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
Introduction¡¡
The¡¡first¡¡puter¡¡programming¡¡book¡¡I¡¡read¡¡was¡¡titled¡¡Programming¡¡Windows¡¡3¡£0¡¡¡¡by¡¡Charles¡¡¡¡
Petzold¡£¡¡This¡¡was¡¡around¡¡the¡¡time¡¡when¡¡Microsoft¡¡Windows¡¡3¡£0¡¡£¨circa¡¡1992£©¡¡once¡¡and¡¡for¡¡all¡¡¡¡
showed¡¡the¡¡industry¡¡that¡¡Microsoft¡¡was¡¡a¡¡pany¡¡with¡¡a¡¡future¡£¡¡Writing¡¡code¡¡for¡¡Windows¡¡back¡¡¡¡
then¡¡was¡¡plicated¡¡by¡¡many¡¡things£º¡¡lack¡¡of¡¡documentation£»¡¡16¡bit¡¡architecture£»¡¡and¡¡the¡¡¡¡
necessity¡¡of¡¡buying¡¡a¡¡piler¡¡separate¡¡from¡¡the¡¡software¡¡development¡¡kit¡¡£¨SDK£©¡£¡¡Charles¡¯s¡¡¡¡
book¡¡tied¡¡everything¡¡together¡¡and¡¡solved¡¡the¡¡problem¡¡of¡¡how¡¡to¡¡write¡¡a¡¡program¡¡for¡¡Windows¡£¡¡
¡¡¡¡¡¡¡¡¡¡Now¡¡the¡¡problems¡¡are¡¡quite¡¡the¡¡opposite£º¡¡we¡¡have¡¡too¡¡much¡¡documentation£»¡¡we¡¡have¡¡64¡bit¡¡¡¡
architectures£»¡¡and¡¡everything¡¡including¡¡the¡¡kitchen¡¡sink¡¡is¡¡thrown¡¡into¡¡a¡¡development¡¡environ
ment¡£¡¡Now¡¡we¡¡need¡¡to¡¡figure¡¡out¡¡what¡¡we¡¡actually¡¡need¡£¡¡We¡¡have¡¡too¡¡many¡¡options¡ªtoo¡¡many¡¡¡¡
ways¡¡to¡¡solve¡¡the¡¡same¡¡problem¡£¡¡What¡¡I¡¡am¡¡trying¡¡to¡¡do¡¡with¡¡this¡¡book¡¡is¡¡the¡¡same¡¡thing¡¡that¡¡¡¡
Charles¡¡did¡¡for¡¡me¡¡when¡¡I¡¡first¡¡started¡¡out£»¡¡and¡¡that¡¡was¡¡to¡¡help¡¡me¡¡figure¡¡out¡¡what¡¡I¡¡needed¡¡to¡¡¡¡
write¡¡code¡£¡¡
¡¡¡¡¡¡¡¡¡¡This¡¡book¡¡is¡¡about¡¡explaining¡¡the¡¡Visual¡¡Basic¡¡programming¡¡language¡¡in¡¡the¡¡context¡¡of¡¡¡¡
solving¡¡problems¡£¡¡Visual¡¡Basic¡¡has¡¡bee¡¡a¡¡sophisticated¡¡programming¡¡language¡¡that¡¡can¡¡¡¡
achieve¡¡many¡¡goals£»¡¡but¡¡you¡¡are¡¡left¡¡wondering¡¡what¡¡techniques¡¡to¡¡use¡¡when¡£¡¡This¡¡book¡¡is¡¡here¡¡¡¡
to¡¡answer¡¡your¡¡questions¡£¡¡
¡¡¡¡¡¡¡¡¡¡This¡¡book¡¡is¡¡not¡¡a¡¡reference¡¡to¡¡all¡¡of¡¡the¡¡features¡¡of¡¡the¡¡Visual¡¡Basic¡¡programming¡¡language¡£¡¡¡¡
I¡¡don¡¯t¡¡explain¡¡the¡¡esoteric¡¡Visual¡¡Basic¡¡features¡£¡¡I¡¡stick¡¡to¡¡the¡¡Visual¡¡Basic¡¡programming¡¡features¡¡¡¡
that¡¡you¡¡will¡¡use¡¡day¡¡in¡¡and¡¡day¡¡out¡£¡¡That¡¡does¡¡not¡¡mean¡¡that¡¡you¡¡will¡¡be¡¡missing¡¡certain¡¡Visual¡¡¡¡
Basic¡¡programming¡¡language¡¡constructs£»¡¡because¡¡I¡¡have¡¡covered¡¡all¡¡of¡¡the¡¡major¡¡features¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡To¡¡get¡¡the¡¡full¡¡benefit¡¡of¡¡this¡¡book£»¡¡I¡¡suggest¡¡that¡¡you¡¡do¡¡the¡¡exercises¡¡at¡¡the¡¡end¡¡of¡¡the¡¡chapters¡£¡¡¡¡
The¡¡answers¡¡are¡¡available¡¡on¡¡the¡¡Apress¡¡web¡¡site¡¡£¨¡¡http£º//apress¡££©£»¡¡and¡¡you¡¡can¡¡cheat¡¡¡¡
and¡¡not¡¡do¡¡the¡¡exercises£»¡¡but¡¡I¡¡advise¡¡against¡¡that¡£¡¡
¡¡¡¡¡¡¡¡¡¡If¡¡you¡¡are¡¡a¡¡beginning¡¡programmer¡¡who¡¡has¡¡no¡¡clue¡¡about¡¡Visual¡¡Basic£»¡¡and¡¡you¡¡read¡¡this¡¡¡¡
book¡¡and¡¡do¡¡the¡¡exercises£»¡¡I¡¡believe¡¡that¡¡you¡¡will¡¡be¡¡a¡¡solid¡¡and¡¡knowledgeable¡¡Visual¡¡Basic¡¡¡¡
programmer¡¡by¡¡the¡¡end¡¡of¡¡the¡¡book¡£¡¡If¡¡that¡¡sounds¡¡like¡¡a¡¡big¡¡promise£»¡¡well£»¡¡yes¡¡it¡¡is¡£¡¡The¡¡chapter¡¡¡¡
text¡¡is¡¡intended¡¡to¡¡get¡¡you¡¡acquainted¡¡with¡¡the¡¡Visual¡¡Basic¡¡programming¡¡language¡¡and¡¡how¡¡to¡¡¡¡
apply¡¡its¡¡features¡£¡¡The¡¡exercises¡¡are¡¡intended¡¡to¡¡make¡¡sure¡¡you¡¡actually¡¡understand¡¡the¡¡Visual¡¡¡¡
Basic¡¡programming¡¡language¡¡and¡¡its¡¡features¡£¡¡
¡¡¡¡¡¡¡¡¡¡The¡¡chapter¡¡exercises¡¡are¡¡challenging¡£¡¡They¡¡cannot¡¡be¡¡solved¡¡within¡¡a¡¡few¡¡minutes¡£¡¡In¡¡fact£»¡¡¡¡
when¡¡I¡¡did¡¡all¡¡of¡¡the¡¡exercises£»¡¡it¡¡took¡¡me¡¡five¡¡working¡hour¡¡days¡¡to¡¡do¡¡all¡¡of¡¡them£¡¡¡
¡¡¡¡¡¡¡¡¡¡If¡¡you¡¡have¡¡any¡¡questions£»¡¡such¡¡as£»¡¡¡°So¡¡what¡¡was¡¡he¡¡trying¡¡to¡¡get¡¡at¡¡with¡¡that¡¡exercise£¿¡±¡¡I¡¡am¡¡¡¡
available¡¡on¡¡Skype¡¡with¡¡the¡¡user¡¡ID¡¡christianhgross¡£¡¡Please¡¡don¡¯t¡¡just¡¡ring¡¡me¡£¡¡First¡¡chat¡¡using¡¡¡¡
text£»¡¡and¡¡if¡¡necessary£»¡¡we¡¡can¡¡have¡¡a¡¡voice¡¡conversation¡£¡¡Also£»¡¡you¡¡can¡¡send¡¡e¡mail¡¡to¡¡me¡¡at¡¡¡¡
christianhgross@gmail¡£¡£¡¡
¡¡¡¡¡¡¡¡¡¡Thanks¡¡and¡¡good¡¡luck¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡xix¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡22¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡23¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
C¡¡¡¡H¡¡¡¡A¡¡¡¡P¡¡¡¡T¡¡¡¡E¡¡¡¡R¡¡¡¡¡¡¡¡¡¡1¡¡
¡ö¡¡¡ö¡¡¡ö¡¡
¡¡Ready£»¡¡Steady£»¡¡Go£¡¡¡
This¡¡book¡¡is¡¡about¡¡the¡¡Visual¡¡Basic¡¡programming¡¡language¡¡first¡¡and¡¡foremost¡£¡¡It¡¡is¡¡about¡¡¡¡
being¡¡a¡¡proficient¡¡Visual¡¡Basic¡¡programmer¡£¡¡Reading¡¡this¡¡book¡¡from¡¡cover¡¡to¡¡cover¡¡will¡¡not¡¡¡¡
make¡¡you¡¡a¡¡superstar£»¡¡but¡¡it¡¡will¡¡make¡¡you¡¡a¡¡programmer¡¡who¡¡understands¡¡what¡¡needs¡¡to¡¡be¡¡¡¡
done¡¡when¡¡writing¡¡robust£»¡¡stable£»¡¡and¡¡maintainable¡¡Visual¡¡Basic¡¡applications¡£¡¡
¡¡¡¡¡¡¡¡¡¡In¡¡this¡¡chapter£»¡¡you¡¯ll¡¡get¡¡started¡¡by¡¡acquiring¡¡the¡¡tools¡¡you¡¡need¡¡to¡¡develop¡¡Visual¡¡Basic¡¡¡¡
applications¡¡and¡¡taking¡¡those¡¡tools¡¡for¡¡a¡¡test¡¡spin¡£¡¡Along¡¡the¡¡way£»¡¡you¡¯ll¡¡create¡¡a¡¡couple¡¡Visual¡¡¡¡
Basic¡¡applications¡£¡¡
Downloading¡¡and¡¡Installing¡¡the¡¡Tools¡¡
Getting¡¡started¡¡with¡¡Visual¡¡Basic¡¡2008£»¡¡you¡¯re¡¡probably¡¡really¡¡excited¡¡about¡¡writing¡¡some¡¡code¡¡¡¡
that¡¡does¡¡something¡£¡¡It¡¯s¡¡like¡¡getting¡¡your¡¡driver¡¯s¡¡license¡¡and¡¡wanting¡¡to¡¡drive¡¡a¡¡car¡¡without¡¡¡¡
even¡¡thinking¡¡about¡¡where¡¡you¡¡want¡¡to¡¡go¡£¡¡You¡¡just¡¡want¡¡to¡¡drive¡£¡¡The¡¡great¡¡part¡¡of¡¡¡¡is¡¡that¡¡¡¡
you¡¡can¡¡start¡¡writing¡¡some¡¡code¡¡after¡¡you¡¡have¡¡installed¡¡either¡¡the¡¡¡¡software¡¡development¡¡¡¡
kit¡¡£¨¡¡SDK£©¡¡or¡¡a¡¡Visual¡¡Studio¡¡integrated¡¡development¡¡environment¡¡£¨IDE£©¡£¡¡Downloading¡¡¡¡
and¡¡installing¡¡the¡¡right¡¡environment¡¡is¡¡critical¡¡to¡¡taking¡¡your¡¡first¡¡step¡¡toward¡¡an¡¡enjoyable¡¡¡¡
coding¡¡experience¡£¡¡
¡öNote¡¡¡¡Software¡¡version¡¡numbers£»¡¡product¡¡descriptions£»¡¡and¡¡technologies¡¡can¡¡be¡¡confusing¡£¡¡Having¡¡¡¡
used¡¡Microsoft¡¡technologies¡¡for¡¡over¡¡a¡¡decade£»¡¡I¡¡can¡¡say¡¡that¡¡naming¡¡a¡¡technology¡¡or¡¡product¡¡has¡¡never¡¡been¡¡¡¡
Microsoft¡¯s¡¡strong¡¡point¡£¡¡The¡¡technologies¡¡have¡¡been¡¡great¡¡£¨for¡¡the¡¡most¡¡part£©£»¡¡but¡¡product¡¡classification¡¡and¡¡¡¡
identification¡¡have¡¡not¡¡been¡¡so¡¡great¡£¡¡Thus£»¡¡this¡¡book¡¡covers¡¡the¡¡Visual¡¡Basic¡¡2008¡¡programming¡¡language¡¡¡¡
that¡¡is¡¡used¡¡to¡¡write¡¡applications¡¡for¡¡the¡¡¡¡Framework¡£¡¡With¡¡Visual¡¡Basic¡¡2008£»¡¡the¡¡¡¡3¡£0¡¡and¡¡3¡£5¡¡¡¡
Frameworks¡¡are¡¡used¡£¡¡¡¡3¡£0¡¡gives¡¡you¡¡all¡¡of¡¡the¡¡essentials£»¡¡and¡¡¡¡3¡£5¡¡gives¡¡you¡¡the¡¡extras¡£¡¡
¡¡¡¡¡¡¡¡¡¡For¡¡the¡¡examples¡¡in¡¡this¡¡book£»¡¡you¡¯ll¡¡be¡¡using¡¡Visual¡¡Basic¡¡2008¡¡Express¡¡Edition£»¡¡because¡¡¡¡
it¡¯s¡¡freely¡¡available¡¡and¡¡has¡¡everything¡¡you¡¡need¡¡to¡¡get¡¡started¡¡with¡¡Visual¡¡Basic¡¡2008¡£¡¡The¡¡other¡¡¡¡
Express¡¡Edition¡¡IDEs¡¡available¡¡from¡¡Microsoft¡¡are¡¡tailored¡¡to¡¡different¡¡languages¡¡£¨C#¡¡and¡¡C£«£«£©¡¡¡¡
or£»¡¡in¡¡the¡¡case¡¡of¡¡Visual¡¡Web¡¡Developer¡¡Express£»¡¡specific¡¡functionality¡¡that¡¡is¡¡too¡¡restrictive¡¡for¡¡¡¡
our¡¡purposes¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡1¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡24¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
2¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡AP¡¡T¡¡E¡¡R¡¡¡¡¡¡1¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡R¡¡E¡¡A¡¡DY¡¡£»¡¡¡¡¡¡ST¡¡E¡¡A¡¡DY¡¡£»¡¡¡¡¡¡G¡¡O¡¡£¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Microsoft¡¡also¡¡offers¡¡full¡¡versions¡¡of¡¡the¡¡Visual¡¡Studio¡¡IDE£»¡¡such¡¡as¡¡the¡¡Standard£»¡¡Professional£»¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡and¡¡Team¡¡editions¡£¡¡Each¡¡of¡¡these¡¡editions¡¡has¡¡different¡¡features¡¡and¡¡different¡¡price¡¡tags¡£¡¡See¡¡the¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Microsoft¡¡Visual¡¡Studio¡¡web¡¡site¡¡£¨http£º//msdn2¡£microsoft¡£/en¡us/vstudio/default¡£aspx£©¡¡for¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡more¡¡information¡£¡¡If¡¡you¡¡already¡¡have¡¡Visual¡¡Studio¡¡2008¡¡Professional£»¡¡you¡¡can¡¡use¡¡that¡¡for¡¡the¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡examples¡¡in¡¡this¡¡book¡£¡¡That¡¡edition¡¡can¡¡do¡¡everything¡¡that¡¡Visual¡¡Basic¡¡2008¡¡Express¡¡can¡¡do£»¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡and¡¡in¡¡fact£»¡¡has¡¡many¡¡more¡¡options¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡öNote¡¡¡¡I¡¡personally¡¡use¡¡Visual¡¡Studio¡¡Standard¡¡or¡¡Professional¡¡in¡¡bination¡¡with¡¡other¡¡tools¡¡such¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡as¡¡X¡develop¡¡and¡¡JustCode£¡¡¡from¡¡Omnicore¡¡£¨http£º//omnicore¡££©£»¡¡TestDriven¡¡£¨¡¡http£º//¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡testdriven/£©£»¡¡and¡¡NUnit¡¡£¨¡¡http£º//nunit¡£org£©¡£¡¡The¡¡Visual¡¡Studio¡¡products¡¡are¡¡very¡¡good£»¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡but¡¡others¡¡are¡¡available¡£¡¡Being¡¡a¡¡good¡¡developer¡¡means¡¡knowing¡¡which¡¡tools¡¡work¡¡best¡¡for¡¡you¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Installing¡¡and¡¡downloading¡¡Visual¡¡Basic¡¡Express¡¡from¡¡the¡¡Microsoft¡¡web¡¡site¡¡involves¡¡the¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡transfer¡¡of¡¡large¡¡files¡£¡¡If¡¡you¡¡do¡¡not¡¡have¡¡a¡¡broadband¡¡connection£»¡¡I¡¡suggest¡¡that¡¡you¡¡install¡¡the¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡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¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·ҳ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿!
ÎÂÜ°Ìáʾ£º ο´Ð¡ËµµÄͬʱ·¢±íÆÀÂÛ£¬Ëµ³ö×Ô¼ºµÄ¿´·¨ºÍÆäËüС»ï°éÃÇ·ÖÏíÒ²²»´íŶ£¡·¢±íÊéÆÀ»¹¿ÉÒÔ»ñµÃ»ý·ÖºÍ¾Ñé½±Àø£¬ÈÏÕæдԴ´ÊéÆÀ ±»²ÉÄÉΪ¾«ÆÀ¿ÉÒÔ»ñµÃ´óÁ¿½ð±Ò¡¢»ý·ÖºÍ¾Ñé½±ÀøŶ£¡