Sub åè¿ç¨æ¯å¨ååºäºä»¶æ¶æ§è¡ç代ç åãå°æ¨¡åä¸ç代ç åæåè¿ç¨åï¼å¨åºç¨ç¨åºä¸æ¥æ¾åä¿®æ¹ä»£ç åå¾æ´å®¹æäºã
åè¿ç¨çè¯æ³æ¯ï¼
[Private|Public][Static]Sub procedurename (arguments)
statements
End Sub
Functionå½æ°è¿ç¨
Visual Basic å
å«å
ç½®çãæå
é¨çå½æ°ï¼å¦ SqrãCos æ Chrãæ¤å¤ï¼è¿å¯ç¨ Function è¯å¥ç¼åèªå·±ç Function è¿ç¨ã
å½æ°è¿ç¨çè¯æ³æ¯ï¼
Private|Public][Static]Function procedurename (arguments) [As type]
statements
End Function
ä¸ Sub è¿ç¨ä¸æ ·ï¼Function è¿ç¨ä¹æ¯ä¸ä¸ªç¬ç«çè¿ç¨ï¼å¯è¯»ååæ°ãæ§è¡ä¸ç³»åè¯å¥å¹¶æ¹åå
¶åæ°çå¼ãä¸åè¿ç¨ä¸åï¼Function è¿ç¨å¯è¿åä¸ä¸ªå¼å°è°ç¨çè¿ç¨
Propertyå±æ§è¿ç¨
Visual Basic æä¾ä¸è¡¨æåçä¸ç§å±æ§è¿ç¨ã
è¿ç¨ ç®ç
Property Get è¿åå±æ§çå¼
Property Let 设置å±æ§çå¼
Property Set 设置对象å±æ§çå¼ï¼å³ï¼è¯¥å±æ§å«æ对象å¼ç¨ï¼ã
ä»ä¸è¡¨å¯è§ï¼æ¯ä¸ä¸ªå±æ§è¿ç¨é½æèªå·±ç¹æ®çåè½ãå
¸åçå±æ§ç±ä¸å¯¹å±æ§è¿ç¨ç»æï¼Property Get æ£ç´¢å±æ§çå¼ï¼Property Let æ Property Set ç»å±æ§èµå¼ã
Eventäºä»¶è¿ç¨
å®ä¹ç¨æ·èªå®ä¹çäºä»¶ã
è¯æ³
[Public] Event procedurename [(arglist)]
温馨提示:内容为网友见解,仅供参考