I have the following routine I use to check for a certain tab page. I want to enable this tab page only on the tab control and set the focus. However, I cannot get the tab to set focus no matter what I do. Any suggestions?
Public Sub SetTabs(ByVal TabID As String)
For Each Ctrl As Control In Me.Controls
If TypeOf Ctrl Is TabControl Then
If Ctrl.HasChildre n Then
For Each cCtrl As Control In Ctrl.Controls
If TypeOf cCtrl Is TabPage Then
If cCtrl.Name = TabID Then
Ctrl.Enabled = True
Ctrl.Visible = True
cCtrl.Enabled = True
cCtrl.Visible = True
Me.ActiveContro l = cCtrl
Else
cCtrl.Enabled = False
End If
End If
Next
Else
Ctrl.Enabled = True
Ctrl.Visible = True
Me.ActiveContro l = Ctrl
End If
End If
Next
End Sub
Public Sub SetTabs(ByVal TabID As String)
For Each Ctrl As Control In Me.Controls
If TypeOf Ctrl Is TabControl Then
If Ctrl.HasChildre n Then
For Each cCtrl As Control In Ctrl.Controls
If TypeOf cCtrl Is TabPage Then
If cCtrl.Name = TabID Then
Ctrl.Enabled = True
Ctrl.Visible = True
cCtrl.Enabled = True
cCtrl.Visible = True
Me.ActiveContro l = cCtrl
Else
cCtrl.Enabled = False
End If
End If
Next
Else
Ctrl.Enabled = True
Ctrl.Visible = True
Me.ActiveContro l = Ctrl
End If
End If
Next
End Sub
Comment