home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / cancelbt / mainform.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-06  |  1.6 KB  |  60 lines

  1. VERSION 2.00
  2. Begin Form MainForm 
  3.    Caption         =   "Main Process Form"
  4.    ClientHeight    =   3720
  5.    ClientLeft      =   1980
  6.    ClientTop       =   1755
  7.    ClientWidth     =   5460
  8.    Height          =   4125
  9.    Left            =   1920
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3720
  12.    ScaleWidth      =   5460
  13.    Top             =   1410
  14.    Width           =   5580
  15.    Begin TextBox Text1 
  16.       BorderStyle     =   0  'None
  17.       Height          =   315
  18.       Left            =   2220
  19.       TabIndex        =   2
  20.       Top             =   2760
  21.       Width           =   2055
  22.    End
  23.    Begin CommandButton Command1 
  24.       Caption         =   "Begin Long Process"
  25.       Height          =   675
  26.       Left            =   1560
  27.       TabIndex        =   0
  28.       Top             =   1560
  29.       Width           =   2295
  30.    End
  31.    Begin Label Label1 
  32.       Alignment       =   1  'Right Justify
  33.       Caption         =   "Status:"
  34.       Height          =   255
  35.       Left            =   1080
  36.       TabIndex        =   1
  37.       Top             =   2760
  38.       Width           =   1035
  39.    End
  40. Sub Command1_Click ()
  41.     Dim x%, Counter&
  42.     Text1.Tag = ""
  43.     Text1.Text = "Running..."
  44.     CanDialog.Show
  45.     Counter = 0
  46.     Do While Counter < 15000 And Text1.Tag = ""
  47.         x% = DoEvents()
  48.         Counter = Counter + 1
  49.     Loop
  50.     Unload CanDialog
  51.     Beep
  52.     If Text1.Tag = "" Then
  53.         Text1.Text = "Completed."
  54.         MsgBox "Process Completed."
  55.     Else
  56.         Text1.Text = "Cancelled..."
  57.         MsgBox "Process Cancelled!"
  58.     End If
  59. End Sub
  60.