>>Dear foxpro'ers,
>>
>>Last week I had a conversation with a friend of my in which he asked me :
>>
>>What can you do with "WITH.. ENDWITH" in a DO function. Unfortunately I could not answer him right away.
>>
>>So know I'm also interested in the workting of "WITH.. ENDWITH" in a DO function.
>>
>>If you can help me with this, please do.
>>
>>
>>
>>Thank you very Much,
>>
>>
>>
>>Luco Buhrs
>>
>>On Koos Veel's Account
>Hi Koos,
>As I can see, you already had replies, and you want to learn what "with..endwith" does. Just to expand them a little bit.
thisform.mypageframe1.activepage = 2
>thisform.mypageframe1.page2.caption = "This is page 2"
>thisform.text2.value = "Anyvalue"
>thisform.mypageframe1.page2.text1.value = "Hello"
>thisform.mypageframe1.page2.text1.refresh()
>thisform.mypageframe1.page3.caption = "This is page 3"
>
>* Could be written as
>with thisform.mypageframe1
> .activepage = 2
> with .page2
> .caption = "This is page 2"
> thisform.text2.value = "Anyvalue"
> with .textbox
> .value = "Hello"
> .refresh()
> endwith
> endwith
> with .page3
> .caption = "This is page 3"
> endwith
>endwith
So it serves for two things :
>1) Less typing and easy reading
>2) Object and its hierarchy would be searched once to find the target hence speeding up the code (so I prefer with..endwith even it's two lines of calling the same object).
>Cetin
And one more thing, to make corretion to this code I would only change :
> with .textbox
to
with .text1
Cetin