home *** CD-ROM | disk | FTP | other *** search
/ Using Visual Basic 5 (Platinum Edition) / vb5.iso / Code / ch16 / report.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-07-04  |  6.7 KB  |  208 lines

  1. VERSION 5.00
  2. Object = "{00025600-0000-0000-C000-000000000046}#4.6#0"; "CRYSTL32.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
  4. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
  5. Begin VB.Form flreport 
  6.    Appearance      =   0  'Flat
  7.    BackColor       =   &H00C0C0C0&
  8.    BorderStyle     =   3  'Fixed Dialog
  9.    Caption         =   "Demo Report Selection"
  10.    ClientHeight    =   3960
  11.    ClientLeft      =   2505
  12.    ClientTop       =   2085
  13.    ClientWidth     =   6465
  14.    ClipControls    =   0   'False
  15.    ControlBox      =   0   'False
  16.    BeginProperty Font 
  17.       Name            =   "MS Sans Serif"
  18.       Size            =   8.25
  19.       Charset         =   0
  20.       Weight          =   700
  21.       Underline       =   0   'False
  22.       Italic          =   0   'False
  23.       Strikethrough   =   0   'False
  24.    EndProperty
  25.    ForeColor       =   &H80000008&
  26.    LinkTopic       =   "Form1"
  27.    PaletteMode     =   1  'UseZOrder
  28.    ScaleHeight     =   3960
  29.    ScaleWidth      =   6465
  30.    Begin ComctlLib.TreeView TreeView1 
  31.       Height          =   3735
  32.       Left            =   120
  33.       TabIndex        =   6
  34.       Top             =   120
  35.       Width           =   4575
  36.       _ExtentX        =   8070
  37.       _ExtentY        =   6588
  38.       _Version        =   327680
  39.       LabelEdit       =   1
  40.       Style           =   5
  41.       ImageList       =   "ImageList1"
  42.       BorderStyle     =   1
  43.       Appearance      =   1
  44.       MouseIcon       =   "report.frx":0000
  45.    End
  46.    Begin MSComDlg.CommonDialog CommonDialog1 
  47.       Left            =   5760
  48.       Top             =   2640
  49.       _ExtentX        =   847
  50.       _ExtentY        =   847
  51.       _Version        =   327680
  52.    End
  53.    Begin VB.Frame Frame1 
  54.       Caption         =   "Display"
  55.       Height          =   975
  56.       Left            =   4920
  57.       TabIndex        =   3
  58.       Top             =   120
  59.       Width           =   1215
  60.       Begin VB.OptionButton Window 
  61.          Caption         =   "Screen"
  62.          Height          =   255
  63.          Left            =   120
  64.          TabIndex        =   5
  65.          Top             =   600
  66.          Width           =   975
  67.       End
  68.       Begin VB.OptionButton Printer 
  69.          Caption         =   "Printer"
  70.          Height          =   255
  71.          Left            =   120
  72.          TabIndex        =   4
  73.          Top             =   240
  74.          Width           =   975
  75.       End
  76.    End
  77.    Begin VB.CommandButton But_setup 
  78.       Appearance      =   0  'Flat
  79.       BackColor       =   &H80000005&
  80.       Caption         =   "Printer  >>"
  81.       Height          =   375
  82.       Left            =   4920
  83.       TabIndex        =   2
  84.       Top             =   1680
  85.       Width           =   1095
  86.    End
  87.    Begin VB.CommandButton But_print 
  88.       Appearance      =   0  'Flat
  89.       BackColor       =   &H80000005&
  90.       Caption         =   "&Print"
  91.       Height          =   375
  92.       Left            =   4920
  93.       TabIndex        =   1
  94.       Top             =   1200
  95.       Width           =   1095
  96.    End
  97.    Begin VB.CommandButton But_close 
  98.       Appearance      =   0  'Flat
  99.       BackColor       =   &H80000005&
  100.       Caption         =   "&Close"
  101.       Height          =   375
  102.       Left            =   4920
  103.       TabIndex        =   0
  104.       Top             =   2160
  105.       Width           =   1095
  106.    End
  107.    Begin Crystal.CrystalReport Report1 
  108.       Left            =   4920
  109.       Top             =   2760
  110.       _ExtentX        =   741
  111.       _ExtentY        =   741
  112.       _Version        =   262150
  113.       WindowControlBox=   -1  'True
  114.       WindowMaxButton =   -1  'True
  115.       WindowMinButton =   -1  'True
  116.       WindowControls  =   -1  'True
  117.    End
  118.    Begin ComctlLib.ImageList ImageList1 
  119.       Left            =   5160
  120.       Top             =   3240
  121.       _ExtentX        =   1005
  122.       _ExtentY        =   1005
  123.       BackColor       =   -2147483643
  124.       ImageWidth      =   16
  125.       ImageHeight     =   15
  126.       MaskColor       =   12632256
  127.       _Version        =   327680
  128.       BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
  129.          NumListImages   =   2
  130.          BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  131.             Picture         =   "report.frx":001C
  132.             Key             =   ""
  133.          EndProperty
  134.          BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  135.             Picture         =   "report.frx":01AE
  136.             Key             =   ""
  137.          EndProperty
  138.       EndProperty
  139.    End
  140. Attribute VB_Name = "flreport"
  141. Attribute VB_GlobalNameSpace = False
  142. Attribute VB_Creatable = False
  143. Attribute VB_PredeclaredId = True
  144. Attribute VB_Exposed = False
  145. Option Explicit
  146. Dim i As Integer
  147. Dim reports(15) As String
  148. Dim MyNode As Node
  149. Dim Total_Reports As Integer
  150. Private Sub but_close_Click()
  151. Unload Me
  152. End Sub
  153. Private Sub but_print_Click()
  154.     If reports(TreeView1.SelectedItem.Index) = "NA" _
  155.     Or TreeView1.SelectedItem.Index = 1 Then
  156.         MsgBox "You must first select a Report.", vbCritical, "Demo Message"
  157.         Exit Sub
  158.     End If
  159.     On Error GoTo errorhandle
  160.     Report1.SelectionFormula = ""
  161.     Report1.ReportFileName = "C:\temp\" & reports(TreeView1.SelectedItem.Index) & ".rpt"
  162.     For i = 0 To 15
  163.         Report1.DataFiles(i) = ""
  164.     Next i
  165.     Report1.DataFiles(0) = "C:\program files\devstudio\vb\nwind.mdb"
  166.     Report1.WindowTitle = "Demo Reporting"
  167.     Report1.WindowMinButton = False
  168.     If Window.Value Then
  169.         Report1.Destination = 0
  170.     Else
  171.         Report1.Destination = 1
  172.     End If
  173.     Report1.Action = 1
  174.     Exit Sub
  175. errorhandle:
  176.     MsgBox "An error has occurred during Reporting with Error Number " & Err & Chr(13) & Error$, vbInformation, "Demo Message"
  177.     Resume Next
  178. End Sub
  179. Private Sub But_setup_Click()
  180. CommonDialog1.Action = 5
  181. Report1.CopiesToPrinter = CommonDialog1.Copies
  182. End Sub
  183. Private Sub Form_Load()
  184. Window.Value = True
  185. But_print.Caption = "Display"
  186. Report1.WindowTitle = "Demo Reporting"
  187. Report1.WindowMinButton = False
  188. 'Initialize the TreeView Structure
  189. TreeView1.Nodes.Clear
  190. 'Set the Report List Header
  191. Set MyNode = TreeView1.Nodes.Add(, , "T", "Demo Crystal Reports Manager", 2)
  192. MyNode.EnsureVisible
  193. Total_Reports = 1
  194. 'Loop until there are no more reports to add
  195. 'Use an input file to hold the report names and levels
  196. For i = 2 To Total_Reports + 1
  197.     'Set the Report Names
  198.     Set MyNode = TreeView1.Nodes.Add("T", tvwChild, "R1", "Crystal Report Demo Report", 1)
  199.     reports(i) = "Chaptern"
  200. Next i
  201. End Sub
  202. Private Sub printer_Click()
  203. But_print.Caption = "Print"
  204. End Sub
  205. Private Sub Window_Click()
  206. But_print.Caption = "Display"
  207. End Sub
  208.