VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   2280
      TabIndex        =   1
      Text            =   "Text2"
      Top             =   2160
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   960
      TabIndex        =   0
      Text            =   "Text1"
      Top             =   1200
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private m_TabStops() As Boolean
Private Sub Form_Load()

    StoreTabsStops
    
End Sub

Private Sub Text1_GotFocus()
      
    TurnOffTabStops
    
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

    If KeyAscii = vbKeyTab Then
        KeyAscii = 0 ' "Eat" the tab to avoid the beep
        RestoreTabStops Text1
    End If

End Sub

Public Sub StoreTabsStops()
      
    Dim intIndex As Integer

    'Store the TabStop property for each control on the form. If you run into
    'a control without a TabStop, just add an On Error Resume line
    ReDim m_TabStops(0 To Controls.Count - 1) As Boolean
    
    For intIndex = 0 To Controls.Count - 1
       m_TabStops(intIndex) = Controls(intIndex).TabStop
    Next

End Sub

Public Sub RestoreTabStops(oObj As Control)

    Dim intIndex As Integer

    'Restore the Tabstop property for each control on the form
    For intIndex = 0 To Controls.Count - 1
       Controls(intIndex).TabStop = m_TabStops(intIndex)
    Next
    
    MsgBox "You just tabbed out of " & oObj.Name
    SendKeys "{Tab}"

End Sub

Public Sub TurnOffTabStops()
      
    Dim intIndex As Integer
    
    For intIndex = 0 To Controls.Count - 1
       Controls(intIndex).TabStop = False
    Next

End Sub
Private Sub Text2_GotFocus()
      
    TurnOffTabStops

End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)

    If KeyAscii = vbKeyTab Then
        KeyAscii = 0 ' "Eat" the tab to avoid the beep
        RestoreTabStops Text2
    End If

End Sub
