Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Do .. with... endwith
Message
De
30/06/1998 13:03:28
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
29/06/1998 09:34:25
Koos Veel
Gamma Research
Aruba
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00112459
Message ID:
00113000
Vues:
16
>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
Ç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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform