Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What's wrong with this line of code....
Message
 
À
16/11/1999 16:10:55
Jimmy Ditta
Twin City Electronics
Monroe, Louisiane, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00291618
Message ID:
00291637
Vues:
21
Couple of observations here....

First, by default, an optiongroup holds a numeric type which corresponds to the ordinal positon of the contained option buttons. So, if the 5th button in the group is selected, the value of the optiongroup will be 5.

Second, the way you are constructing your syntax is a nightmare in waiting. Based on the code, the assumption is that the option group will ALWAYS be in page1 of pageframe1 and that the pageframe will always be directly contained on the form.

You are using what I like to call the outside-in approach. I like the inside-out approach, one where you traverse the containership hierachy. So, if a control that shares the same parent container needs to query the value, this code will work:

If This.Parent.OptionGroup1.Value = 5
Endif

In cases where other controls in other containers need access to the optiongroup, you can have a form-level property points to the option group. Then, any controls that need to reference the optiongroup could do so as follows:

If thisform.oOptionGroup.Value = 5
EndIf

The deal is that there should be MINIMAL code changes when moving controls around....
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform