R
Rob W
Greetings,
I want to select focus to the first item on a tab page of a tab control.
I wrote some code below which loops around the controls within the current
selected tab page (At the time I wasn't aware it only looped around
container components on my form - groupboxes).
Not the most efficient code but by the end, I have stored the groupbox name
with the lowest tab index i.e. at top of the tab.
I have only referenced items before by index i.e.
Me.Controls.Item(1).Controls how can I reference the groupbox item by name
as retrieved by my code in a string variable ?
i.e. To enable me to loop through the textboxes to find that with the lowest
tab index to set focus to
For each textbox in Me.Controls(grpcontrolname).controls ??
Hope this makes sense (see code below to select groupbox with the lowest tab
index) .....
For Each grpcontrol In tabAddMember.SelectedTab.Controls
If grpcontrol.TabIndex < grpIndexLow Then
'Set string variable to store control name
grpcontrolname = grpcontrol.Name
'set new lowest index to be that of control item
grpIndexLow = grpcontrol.TabIndex
End If
Next grpcontrol
I want to select focus to the first item on a tab page of a tab control.
I wrote some code below which loops around the controls within the current
selected tab page (At the time I wasn't aware it only looped around
container components on my form - groupboxes).
Not the most efficient code but by the end, I have stored the groupbox name
with the lowest tab index i.e. at top of the tab.
I have only referenced items before by index i.e.
Me.Controls.Item(1).Controls how can I reference the groupbox item by name
as retrieved by my code in a string variable ?
i.e. To enable me to loop through the textboxes to find that with the lowest
tab index to set focus to
For each textbox in Me.Controls(grpcontrolname).controls ??
Hope this makes sense (see code below to select groupbox with the lowest tab
index) .....
For Each grpcontrol In tabAddMember.SelectedTab.Controls
If grpcontrol.TabIndex < grpIndexLow Then
'Set string variable to store control name
grpcontrolname = grpcontrol.Name
'set new lowest index to be that of control item
grpIndexLow = grpcontrol.TabIndex
End If
Next grpcontrol