Referencing Toggle Buttons in a loop

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a situation where I need to reference multiple toggle buttons by
reference. I need to create a loop where each toggle button object is
individual controlled. For example, the following pseudo-code demonstrates
my intent:

While (togglebuttone_object <> Null)
ToggleButtonObject.Caption = “Some Valueâ€
ToggleButtonObject = Next ToggleButtonObject
Wend

Your suggestions are greatly appreciated

Thanks,

Eddie
 
Dim ctlCurr As Control

For Each ctlCurr In Me.Controls
If TypeOf ctlCurr Is ToggleButton
ctlCurr.Caption = ...
End If
Next ctlCurr

Of course, if you've only got a few, it's probably easier to simply refer to
them by name.
 
Thanks Douglas,

I will give this a try

Douglas J. Steele said:
Dim ctlCurr As Control

For Each ctlCurr In Me.Controls
If TypeOf ctlCurr Is ToggleButton
ctlCurr.Caption = ...
End If
Next ctlCurr

Of course, if you've only got a few, it's probably easier to simply refer to
them by name.
 
Back
Top