Information générale
Catégorie:
Codage, syntaxe et commandes
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement