Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Do .. with... endwith
Message
From
30/06/1998 13:05:28
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
30/06/1998 13:03:28
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00112459
Message ID:
00113001
Views:
28
>>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform