Hello,
I have a SSTab control on a form. There are three tabs, each tab contains multiple textboxes, checkboxes, and comboboxes. I am using a code snippet provided in a VB6 book to prevent the focus moving off of the current SSTab.Tab if the user tabs through the input controls. The code is as follows:
Sub ChangeTab(SSTab As SSTab)
Dim ctrl As Control, TabIndex As Long
TabIndex = 99999
On Error Resume Next
For Each ctrl In SSTab.Parent.Controls
If ctrl.Container Is SSTab Then
If ctrl.Left < -10000 Then
ctrl.Enabled = False
Else
ctrl.Enabled = True
If ctrl.TabIndex >= TabIndex Then
Else
TabIndex = ctrl.TabIndex
ctrl.SetFocus
End If
End If
End If
Next
End Sub
The code works as intended, if you tab through the controls you will move from the last control to the first on that tab. However, when this code is executed (triggered by SSTab1_Click) it disables the menu items for frmMain. My understanding is that the menu is not within the SSTab container, but I don't know why it would be affected if it wasn't. Am I doing something strange? Is there another way to handle this?
Thank you very much for any assistance.
Regards.
I have a SSTab control on a form. There are three tabs, each tab contains multiple textboxes, checkboxes, and comboboxes. I am using a code snippet provided in a VB6 book to prevent the focus moving off of the current SSTab.Tab if the user tabs through the input controls. The code is as follows:
Sub ChangeTab(SSTab As SSTab)
Dim ctrl As Control, TabIndex As Long
TabIndex = 99999
On Error Resume Next
For Each ctrl In SSTab.Parent.Controls
If ctrl.Container Is SSTab Then
If ctrl.Left < -10000 Then
ctrl.Enabled = False
Else
ctrl.Enabled = True
If ctrl.TabIndex >= TabIndex Then
Else
TabIndex = ctrl.TabIndex
ctrl.SetFocus
End If
End If
End If
Next
End Sub
The code works as intended, if you tab through the controls you will move from the last control to the first on that tab. However, when this code is executed (triggered by SSTab1_Click) it disables the menu items for frmMain. My understanding is that the menu is not within the SSTab container, but I don't know why it would be affected if it wasn't. Am I doing something strange? Is there another way to handle this?
Thank you very much for any assistance.
Regards.