home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap12 / abort.frm < prev    next >
Text File  |  1995-09-24  |  2KB  |  82 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. End
  40. Attribute VB_Name = "Form1"
  41. Attribute VB_Creatable = False
  42. Attribute VB_Exposed = False
  43. Dim printingCancelled As Boolean
  44.  
  45. Private Sub Command1_Click()
  46.     printingCancelled = False
  47.     For i = 1 To 50010000
  48.         DoEvents
  49.         If printingCancelled = True Then
  50.             printingCancelled = False
  51.             Exit For
  52.         End If
  53.         Label1.Caption = "Printing " & i
  54.         Printer.Print i
  55.     Next i
  56. End Sub
  57.  
  58. Private Sub Command2_Click()
  59.     Printer.KillDoc
  60.     printingCancelled = True
  61. End Sub
  62.  
  63. Private Sub Form_Load()
  64.     Label1.Left = 100
  65.     Label1.TOP = 100
  66.     Label1.Height = 200
  67.     Label1.Caption = ""
  68.  
  69.     Command1.Left = 100
  70.     Command1.TOP = 400
  71.     Command1.Caption = "Start"
  72.  
  73.     Command2.Left = 1600
  74.     Command2.TOP = 400
  75.     Command2.Caption = "Cancel"
  76.  
  77.     Form1.Caption = "Visual Basic Printing Test"
  78.     Form1.Height = 2000
  79.     Form1.Width = 4000
  80. End Sub
  81.  
  82.