Vous devez être membre et vous identifier pour publier un article.
Les visiteurs peuvent toutefois commenter chaque article par une réponse.
[VB] Boutons radio (cochés ou pas?)
Article publié le 09/05/2005 18:57:31Comment savoir quelle bouton radio est coché sans les tester un par un ?
Deux méthodes possibles:
Utiliser les opérateurs
Code VisualBASIC ou VBA ou VBS (1 ligne)
MsgBox Op_Condition(Op_Condition(0) * 0 - Op_Condition(1) * 1 - Op_Condition(2) * 2 - Op_Condition(3) * 3).Caption
Valable si on connaît à l’avance le nombre de boutons radios.
Créer une fonction
Code VisualBASIC ou VBA ou VBS (10 lignes)
Private Function QuelleCoche(ObjOptionButton As Variant) As Integer Dim Ctrl As Control Dim i For Each Ctrl In ObjOptionButton If Ctrl = True Then QuelleCoche = i i = i + 1 Next End Function Exemple d'appel MsgBox QuelleCoche(Option1)
Appel - Appeler la fonction "Quellecoche" en passant le nom du controle OptionButton
Réception - Retour d'un entier
Un article de Akira Sato
Source : www.trucsastuces.com
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 13/09/2004, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/ast-rf-238.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.