home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / focusprb / form1.frm < prev    next >
Text File  |  1993-11-17  |  2KB  |  107 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   5076
  5.    ClientLeft      =   1428
  6.    ClientTop       =   1728
  7.    ClientWidth     =   6780
  8.    Height          =   5544
  9.    Left            =   1356
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5076
  12.    ScaleWidth      =   6780
  13.    Top             =   1332
  14.    Width           =   6924
  15.    Begin TextBox Text3 
  16.       Height          =   495
  17.       Left            =   4200
  18.       TabIndex        =   2
  19.       Text            =   "Text3"
  20.       Top             =   1440
  21.       Width           =   1215
  22.    End
  23.    Begin TextBox Text2 
  24.       Height          =   495
  25.       Left            =   2760
  26.       TabIndex        =   1
  27.       Text            =   "Text2"
  28.       Top             =   960
  29.       Width           =   1215
  30.    End
  31.    Begin TextBox Text1 
  32.       Height          =   495
  33.       Left            =   1320
  34.       TabIndex        =   0
  35.       Text            =   "Text1"
  36.       Top             =   480
  37.       Width           =   1215
  38.    End
  39. End
  40.    Dim LastControl As Control
  41.    Dim CurrControl As Control
  42.  
  43. Sub CheckLostFocus ()
  44.  
  45.     If (LastControl.Tag = "True") Then
  46.         X% = MsgBox("Is the value OK ?", 36, LastControl + " has Lost Focus")
  47.         If X% = 6 Then    'if YES
  48.             LastControl.Tag = ""
  49.             CurrControl.SetFocus
  50.         Else
  51.             LastControl.SetFocus
  52.         End If
  53.     End If
  54.  
  55. End Sub
  56.  
  57. Sub Form_Load ()
  58.     Set LastControl = Text1
  59. End Sub
  60.  
  61. Sub Text1_Change ()
  62.     Text1.Tag = "True"
  63. End Sub
  64.  
  65. Sub Text1_GotFocus ()
  66.     Set CurrControl = Text1
  67.     CheckLostFocus
  68. End Sub
  69.  
  70. Sub Text1_KeyPress (KeyAscii As Integer)
  71.     If KeyAscii = 13 Then
  72.         KeyAscii = 0
  73.         Text2.SetFocus
  74.     End If
  75. End Sub
  76.  
  77. Sub Text1_LostFocus ()
  78.     Set LastControl = Text1
  79. End Sub
  80.  
  81. Sub Text2_Change ()
  82.     Text2.Tag = "True"
  83. End Sub
  84.  
  85. Sub Text2_GotFocus ()
  86.     Set CurrControl = Text2
  87.     CheckLostFocus
  88. End Sub
  89.  
  90. Sub Text2_LostFocus ()
  91.     Set LastControl = Text2
  92. End Sub
  93.  
  94. Sub Text3_Change ()
  95.     Text3.Tag = "True"
  96. End Sub
  97.  
  98. Sub Text3_GotFocus ()
  99.     Set CurrControl = Text3
  100.     CheckLostFocus
  101. End Sub
  102.  
  103. Sub Text3_LostFocus ()
  104.     Set LastControl = Text3
  105. End Sub
  106.  
  107.