VB編程:使用Debug.Print調試

儘量使用debug.print進行調試
在很多初學者的調試中,用msgbox來跟蹤變數值.其實用debug.print不僅可以達到同樣的功效,而且在程式最後編譯過程中,會被忽略.而msgbox必須手動注釋或刪除.
通常:
msgbox nname
應該:
debug.print nname

 在重複對某一對象的屬性進行修改時,儘量使用with....end with
通常:
form1.height = 5000
form1.width = 6000
form1.caption = "this is mylabel"
應該:
with form1
.height = 5000
.width = 6000
.caption = "this is mylabel"
end with
這種結構程式執行效率比較高,特別在循環語句里。