Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What's Wrong Here?
Message
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00688853
Message ID:
00688872
Views:
22
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform