Getting a list of controls within a control tab page

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

Guest

Hi There,

I seem to have run into a little problem. I've written some code that builds
a list of controls in their tab control order, which i've been using
extensively. Recently i decided to try use control tabs which appear to be
great, except for the fact that I cannot find a way to build a list of
controls just in a specific tab control page.
The current code: For Each ctl In FormSection.Controls
I figure needs to be updated to something more specifc....

please help:(
Thanks in advance!
 
Check the Parent property of each control.

If the control is a label attached to another control, the label's parent
will be the control it is attached to.
If the control is part of an option group, the parent will be the group.
If the control is sitting on the page of a tab control, the parent is the
page.
If the control is sitting directly on the form, the parent is the form.
 
hi Justin,

Justin said:
I seem to have run into a little problem. I've written some code that builds
a list of controls in their tab control order, which i've been using
extensively. Recently i decided to try use control tabs which appear to be
great, except for the fact that I cannot find a way to build a list of
controls just in a specific tab control page.
The current code: For Each ctl In FormSection.Controls
I figure needs to be updated to something more specifc....
For Each ctl In FormSection.Controls
If TypeOf ctl Is TabControl Then
For Each pg In ctl.Pages
For Each sctl In pg.Controls
'add subcontrols
Next sctl
Next pg
End If
Next ctl


mfG
--> stefan <--
 
Hi,
Thanks for your quick replies... I understand the code and that now works
fine... I seem to have a problem tho when trying to set focus to a control
within a tab control and get the usual error ("Can't move focus to control...
etc...") but it can move focus if I have a dummy control set to tab number
1...
Any ideas how to get around this problem?

Thanks again
 
hi Justin,

Justin said:
I seem to have a problem tho when trying to set focus to a control
within a tab control and get the usual error ("Can't move focus to control...
etc...") but it can move focus if I have a dummy control set to tab number
1...
Any ideas how to get around this problem?
No. I'm trying to avoid moving the focus from one control to another. It
confuses me always, if applications show such a behaviour.

The only case where i have to use OtherControl.SetFocus (it is always
the abort button which gets the focus) is when i must disable the active
control.


mfG
--> stefan <--
 
Back
Top