Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Substitue of VFP Macro Substitution in VB
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00383428
Message ID:
00385782
Vues:
34
It's also worth noting that the entire approach to VB coding doesn't depend as heavily on macro-expansion as VFP does -- in other words, there are often other ways to accomplish the task. There are certainly times that I want macro expansion, and sit there at my machine punching my fist in the air, but 85% of the time I realize that I am thinking too-VFP-ish.

For instance, while in VFP you can "expand" a control name, such as lcTextName (which holds "MyTextBox", in VB you can just refer to Controls(lcTextName). While you might expand a string in VFP that reads "Select name, address1 from customers", in VB you just send this string through a command or recordset object anyway. In fact, I never miss macro-expansion when it comes to data-related commands, since the entire paradigm is different and lends itself, by definition, to a sort of macro expansion.

I do miss macro expansion, in VB, when it comes to Do While.... loops with particular sets of conditions. In VFP you can do this:
IF myName = "Vin"
lcCondition = "name = 'Vin'"
ELSE
lcCondition = ".T."
ENDIF

DO WHILE &lcCondition
.... something here
ENDDO

... while in VB you must take a different approach. Probably putting the DO WHILE in in IF ELSE condition, and calling a sub from each.... or, as has been pointed out, using the Script control.
The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts. - Bertrand Russell
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform