home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / articles / vbpj / source / evtprog3.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-01-29  |  2.8 KB  |  95 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H80000005&
  5.    Caption         =   "Event sample #2"
  6.    ClientHeight    =   3720
  7.    ClientLeft      =   1095
  8.    ClientTop       =   1485
  9.    ClientWidth     =   5940
  10.    BeginProperty Font 
  11.       name            =   "MS Sans Serif"
  12.       charset         =   1
  13.       weight          =   700
  14.       size            =   8.25
  15.       underline       =   0   'False
  16.       italic          =   0   'False
  17.       strikethrough   =   0   'False
  18.    EndProperty
  19.    ForeColor       =   &H80000008&
  20.    Height          =   4125
  21.    Left            =   1035
  22.    LinkTopic       =   "Form1"
  23.    ScaleHeight     =   3720
  24.    ScaleWidth      =   5940
  25.    Top             =   1140
  26.    Width           =   6060
  27.    Begin VB.TextBox Text4 
  28.       Appearance      =   0  'Flat
  29.       Height          =   375
  30.       Left            =   300
  31.       TabIndex        =   4
  32.       Top             =   2340
  33.       Width           =   1815
  34.    End
  35.    Begin VB.TextBox Text3 
  36.       Appearance      =   0  'Flat
  37.       Height          =   375
  38.       Left            =   300
  39.       TabIndex        =   2
  40.       Top             =   1800
  41.       Width           =   1815
  42.    End
  43.    Begin VB.TextBox Text2 
  44.       Appearance      =   0  'Flat
  45.       Height          =   375
  46.       Left            =   300
  47.       TabIndex        =   1
  48.       Text            =   "600"
  49.       Top             =   1200
  50.       Width           =   1815
  51.    End
  52.    Begin VB.TextBox Text1 
  53.       Appearance      =   0  'Flat
  54.       Height          =   435
  55.       Left            =   300
  56.       TabIndex        =   0
  57.       Top             =   540
  58.       Width           =   1815
  59.    End
  60.    Begin VB.Label Label1 
  61.       Appearance      =   0  'Flat
  62.       BackColor       =   &H80000005&
  63.       Caption         =   "Enter #>500 and press tab."
  64.       ForeColor       =   &H80000008&
  65.       Height          =   255
  66.       Left            =   2220
  67.       TabIndex        =   3
  68.       Top             =   600
  69.       Width           =   3015
  70.    End
  71. Attribute VB_Name = "Form1"
  72. Attribute VB_Creatable = False
  73. Attribute VB_Exposed = False
  74. Option Explicit
  75. Private Sub Form_Load()
  76. End Sub
  77. ' An infinite loop can be created as each control
  78. ' fails its valid condition and attempts to set
  79. ' the focus back to itself.
  80. Private Sub Text1_LostFocus()
  81.     If Val(Text1.Text) > 500 Then Text1.SetFocus
  82. End Sub
  83. Private Sub Text2_LostFocus()
  84.     If Val(Text2.Text) > 500 Then Text2.SetFocus
  85. End Sub
  86. ' A stack space overflow can be created when
  87. ' a change in one control causes a change in
  88. ' a second control.
  89. Private Sub Text3_Change()
  90.     text4.Text = Str$(Val(text4.Text) + 1)
  91. End Sub
  92. Private Sub Text4_Change()
  93.     text3.Text = Str$(Val(text3.Text) + 1)
  94. End Sub
  95.