Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VB equivalent to foxpro's IIF
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00379914
Message ID:
00382803
Vues:
16
You can accomplish this behavior in VB by simply using True as your Select Case. Example:
select case True
   case nNumber = 5
      do something
   case Not lTrigger
      do something else
end select
Each expression is evaluated with respect to being equal to True.

>As you know, VFP’s DO CASE allows evaluation of as many conditions as you wish, one on each line of the CASE statement:
>
>Do Case
>Case nNumber = 5
>
>Case lTrigger = .F.
>
>Case dDate = {01/01/00}
>
>End Case
>
>With VB’s CASE statement, you evaluate one condition. To evaluate multiple conditions in VB, the code gets ugly, such as placing one CASE statement inside of another.
>
>The above examples are simple but I hope you get the point. VFP programmers point out “If you want to handle data, use a data centric tool – Visual FoxPro”. I would like to add, if you want to evaluate conditional logical, use Visual FoxPro.
>
>Extend this to how VB handles If statements: If yes and no: If yes or no: etc. and you will see what I mean. If, Case and IIF are very different in VFP and VB.
>
>Tom
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform