∇ With文のススメ ∇
同じコントールや配列を参照する際にはwithを利用する楽です。
例えば、このようなソースがあったとします。
CommonDialog1.DialogTitle = "ファイルを開く"
CommonDialog1.CancelError = True
CommonDialog1.ShowOpen
これをwith文を使って書き換えると、こうなります。
With CommonDialog1
.DialogTitle = "ファイルを開く"
.CancelError = True
.ShowOpen
End With
どうでしょうか。すっきりしました。
実行速度も少し速くなるようです(気にならない程度ですが・・・)
| Infomation | Title :With文のススメ | 2000 6/16 |
| 作成者 : Manabu | ||
| 環境 : VisualBasic 6.0 , InternetExplorer5.0 , Windows98 | ||
1999-2000 Copyright(C) Manabu
1999-00 Manabuの部屋 http://www.manabu.uni.cc/
この文章の無断転際を禁じます