home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / crystal / extras / vbxdemo / printfrm.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-12-15  |  6.4 KB  |  197 lines

  1. VERSION 2.00
  2. Begin Form PrintFrm 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Print To Printer"
  5.    ClientHeight    =   3105
  6.    ClientLeft      =   2085
  7.    ClientTop       =   2445
  8.    ClientWidth     =   5430
  9.    Height          =   3510
  10.    Left            =   2025
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   3105
  15.    ScaleWidth      =   5430
  16.    Top             =   2100
  17.    Width           =   5550
  18.    Begin CommandButton Command1 
  19.       Caption         =   "Select Printer"
  20.       Height          =   405
  21.       Left            =   630
  22.       TabIndex        =   5
  23.       Top             =   2295
  24.       Width           =   1335
  25.    End
  26.    Begin CommandButton Command2 
  27.       Caption         =   "Print"
  28.       Default         =   -1  'True
  29.       Height          =   405
  30.       Left            =   2160
  31.       TabIndex        =   6
  32.       Top             =   2295
  33.       Width           =   1215
  34.    End
  35.    Begin CommandButton Command3 
  36.       Cancel          =   -1  'True
  37.       Caption         =   "Cancel"
  38.       Height          =   405
  39.       Left            =   3600
  40.       TabIndex        =   7
  41.       Top             =   2340
  42.       Width           =   1215
  43.    End
  44.    Begin SSFrame Frame3D1 
  45.       Font3D          =   0  'None
  46.       Height          =   1815
  47.       Left            =   120
  48.       TabIndex        =   8
  49.       Top             =   270
  50.       Width           =   5175
  51.       Begin SSCheck Collate 
  52.          Caption         =   "Collate Copies"
  53.          Font3D          =   0  'None
  54.          Height          =   240
  55.          Left            =   2400
  56.          TabIndex        =   13
  57.          Top             =   1395
  58.          Width           =   1605
  59.       End
  60.       Begin TextBox NDetailCopies 
  61.          Height          =   285
  62.          Left            =   2400
  63.          TabIndex        =   0
  64.          Text            =   "1"
  65.          Top             =   495
  66.          Width           =   615
  67.       End
  68.       Begin TextBox Copies 
  69.          Height          =   285
  70.          Left            =   2400
  71.          TabIndex        =   1
  72.          Text            =   "1"
  73.          Top             =   945
  74.          Width           =   615
  75.       End
  76.       Begin TextBox StartPage 
  77.          Height          =   285
  78.          Left            =   4440
  79.          TabIndex        =   2
  80.          Top             =   450
  81.          Width           =   615
  82.       End
  83.       Begin TextBox EndPage 
  84.          Height          =   285
  85.          Left            =   4440
  86.          TabIndex        =   3
  87.          Top             =   990
  88.          Width           =   615
  89.       End
  90.       Begin SSCheck SavedData 
  91.          Caption         =   "Use Saved Data"
  92.          Font3D          =   0  'None
  93.          Height          =   495
  94.          Left            =   90
  95.          TabIndex        =   4
  96.          Top             =   1260
  97.          Width           =   1815
  98.       End
  99.       Begin Label Label3 
  100.          BackColor       =   &H00C0C0C0&
  101.          Caption         =   "Number of Detail Copies:"
  102.          Height          =   255
  103.          Left            =   120
  104.          TabIndex        =   11
  105.          Top             =   540
  106.          Width           =   2175
  107.       End
  108.       Begin Label Label4 
  109.          BackColor       =   &H00C0C0C0&
  110.          Caption         =   "Number of Report Copies:"
  111.          Height          =   255
  112.          Left            =   90
  113.          TabIndex        =   12
  114.          Top             =   945
  115.          Width           =   2295
  116.       End
  117.       Begin Label Label5 
  118.          BackColor       =   &H00C0C0C0&
  119.          Caption         =   "Starting Page:"
  120.          Height          =   255
  121.          Left            =   3120
  122.          TabIndex        =   9
  123.          Top             =   495
  124.          Width           =   1335
  125.       End
  126.       Begin Label Label6 
  127.          BackColor       =   &H00C0C0C0&
  128.          Caption         =   "Ending Page:"
  129.          Height          =   255
  130.          Left            =   3120
  131.          TabIndex        =   10
  132.          Top             =   990
  133.          Width           =   1215
  134.       End
  135.    End
  136. Sub Command1_Click ()
  137. SelectPrt.Show 1
  138. End Sub
  139. Sub Command2_Click ()
  140.     'Set number of reports to be printed
  141.     Main.Report1.CopiesToPrinter = Copies.Text
  142.     'Set number of detail copies to be printed
  143.     Main.Report1.DetailCopies = NDetailCopies.Text
  144.     'Collate copies if desired
  145.     If Collate.Value = True Then
  146.       Main.Report1.PrinterCollation = 1
  147.     Else
  148.       Main.Report1.PrinterCollation = 0
  149.     End If
  150.     'Set the report to startprinting on page x
  151.     If StartPage.Text = "" Then
  152.       Main.Report1.PrinterStartPage = 0
  153.     Else
  154.       Main.Report1.PrinterStartPage = StartPage.Text
  155.     End If
  156.     'Set the report to endprinting on page y
  157.     If EndPage.Text = "" Then
  158.        Main.Report1.PrinterStopPage = -1
  159.     Else
  160.        Main.Report1.PrinterStopPage = EndPage.Text
  161.     End If
  162.     'Discard saved data if user chooses to
  163.     If SavedData.Value = True Then
  164.        Main.Report1.DiscardSavedData = False
  165.     Else
  166.        Main.Report1.DiscardSavedData = True
  167.     End If
  168.     'Set the Report destination
  169.     Main.Report1.Destination = 1
  170.      FreeRes = FreeResourcesAreAbove(20)
  171.      If FreeRes = False Then
  172.        MsgBox "Your System Resources are below 20% Free, the job cannot be started! Please exit CRPEDemo, close some of your other Windows applications and try again."
  173.        Exit Sub
  174.      End If
  175. 'Set mouse to an Hour glass
  176.     Screen.MousePointer = 11
  177.     Unload Me
  178. 'Print report to printer. If this fails then retrieve the error
  179. 'number and error string and display in a message box. If the call
  180. 'is successful then display the appropriate message in the status
  181. 'bar caption. Notice that the PrintReport property was used
  182. 'so that a Result% was return inorder to do proper error checking
  183.     If Main.Report1.PrintReport <> 0 Then
  184.       Screen.MousePointer = 0
  185.       MsgBox "Printing the Report to Window has caused Error#: " & Main.Report1.LastErrorNumber & " - " & Main.Report1.LastErrorString
  186.       Exit Sub
  187.     Else
  188.       Main!StatusBar.Caption = "Printing to printer Successful."
  189.       'Set the Mouse back to the default(a pointer)
  190.       Screen.MousePointer = 0
  191.     End If
  192.      
  193. End Sub
  194. Sub Command3_Click ()
  195. Unload Me
  196. End Sub
  197.