Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What's Wrong Here?
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00688853
Message ID:
00688872
Vues:
23
>I dropped 3 command buttons on a form from the toolbar, and
>set the captions to "Hello 1", "Hello 2" and "Hello 3". They
>are named "Command1", "Command2" and "Command3".
>
>Then I ran this code, and MsgBox returned "Hello 3"
>
>
>Private Sub Form_Load()
>
>  Dim oButton As CommandButton
>
>  Set oButton = Me.Controls(0)
>
>  MsgBox oButton.Caption
>
>End Sub
>
>
>
>Why isn't button 1 in element 0?

You mean:

dim oB as CommandButton

for each oB in me.controls
msgbox oB.Caption
next

set oB=Nothing

Igor
Igor Gelin
Database Developer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform