home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap12 / abort.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-24  |  2.0 KB  |  74 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   8460
  5.    ClientLeft      =   1140
  6.    ClientTop       =   1515
  7.    ClientWidth     =   6690
  8.    Height          =   8865
  9.    Left            =   1080
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   8460
  12.    ScaleWidth      =   6690
  13.    Top             =   1170
  14.    Width           =   6810
  15.    Begin VB.CommandButton Command2 
  16.       Caption         =   "Command2"
  17.       Height          =   495
  18.       Left            =   2760
  19.       TabIndex        =   2
  20.       Top             =   3960
  21.       Width           =   1215
  22.    End
  23.    Begin VB.CommandButton Command1 
  24.       Caption         =   "Command1"
  25.       Height          =   495
  26.       Left            =   2760
  27.       TabIndex        =   1
  28.       Top             =   3960
  29.       Width           =   1215
  30.    End
  31.    Begin VB.Label Label1 
  32.       Caption         =   "Label1"
  33.       Height          =   495
  34.       Left            =   2760
  35.       TabIndex        =   0
  36.       Top             =   3960
  37.       Width           =   1215
  38.    End
  39. Attribute VB_Name = "Form1"
  40. Attribute VB_Creatable = False
  41. Attribute VB_Exposed = False
  42. Dim printingCancelled As Boolean
  43. Private Sub Command1_Click()
  44.     printingCancelled = False
  45.     For i = 1 To 50010000
  46.         DoEvents
  47.         If printingCancelled = True Then
  48.             printingCancelled = False
  49.             Exit For
  50.         End If
  51.         Label1.Caption = "Printing " & i
  52.         Printer.Print i
  53.     Next i
  54. End Sub
  55. Private Sub Command2_Click()
  56.     Printer.KillDoc
  57.     printingCancelled = True
  58. End Sub
  59. Private Sub Form_Load()
  60.     Label1.Left = 100
  61.     Label1.TOP = 100
  62.     Label1.Height = 200
  63.     Label1.Caption = ""
  64.     Command1.Left = 100
  65.     Command1.TOP = 400
  66.     Command1.Caption = "Start"
  67.     Command2.Left = 1600
  68.     Command2.TOP = 400
  69.     Command2.Caption = "Cancel"
  70.     Form1.Caption = "Visual Basic Printing Test"
  71.     Form1.Height = 2000
  72.     Form1.Width = 4000
  73. End Sub
  74.