What' faster between...

samus535
09-05-2003, 06:02 PM
Hi everybody,
I would like to know wath is faster between those two methods.
1. Use with text1
.text = x
.backcolor = y
etc.
end with

or to enumerate all the properties like that

text1.text=x
text1.backcolor=y
text1.visible=true
etc.

Flyguy
09-05-2003, 06:07 PM
There isn't a real noticable speed difference.
For better reading of the code and easier updating I would use With .. End With

deell
09-05-2003, 09:15 PM
Hi everybody,
I would like to know wath is faster between those two methods.
1. Use with text1
.text = x
.backcolor = y
etc.
end with

or to enumerate all the properties like that

text1.text=x
text1.backcolor=y
text1.visible=true
etc.

u can try to test the speed:

t = Timer
For i = 1 to 100000
[your code]
Next i
msgbox Timer - t

i think theres no different between using 'With' and no 'With'

00100b
09-05-2003, 09:49 PM
With only a few properties/methods that are being referenced, then you won't see a noticeable difference.

What the With statement does is resolve the object reference once so that it doesn't need to be re-qualified each time a method or property for that object is referenced within the With block.

So technically, there is an overhead of object qualification with each reference to one of its members. Will you ever see a difference? Probably not.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum