home *** CD-ROM | disk | FTP | other *** search
/ Master 95 #1 / MASTER95_1.iso / microsof / vbasic4 / vb4-6.cab / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-26  |  6.4 KB  |  204 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   5445
  5.    ClientLeft      =   1110
  6.    ClientTop       =   1380
  7.    ClientWidth     =   8370
  8.    BeginProperty Font 
  9.       name            =   "MS Sans Serif"
  10.       charset         =   1
  11.       weight          =   700
  12.       size            =   8.25
  13.       underline       =   0   'False
  14.       italic          =   0   'False
  15.       strikethrough   =   0   'False
  16.    EndProperty
  17.    Height          =   5850
  18.    Left            =   1050
  19.    LinkTopic       =   "Form1"
  20.    ScaleHeight     =   5445
  21.    ScaleWidth      =   8370
  22.    Top             =   1035
  23.    Width           =   8490
  24.    Begin VB.TextBox RangeEnd 
  25.       Height          =   285
  26.       Left            =   4080
  27.       Locked          =   -1  'True
  28.       TabIndex        =   2
  29.       Text            =   "   "
  30.       Top             =   3000
  31.       Width           =   1455
  32.    End
  33.    Begin VB.TextBox RangeStart 
  34.       Height          =   285
  35.       Left            =   4080
  36.       Locked          =   -1  'True
  37.       TabIndex        =   1
  38.       Text            =   "   "
  39.       Top             =   2520
  40.       Width           =   1455
  41.    End
  42.    Begin VB.CommandButton Print_Report 
  43.       Caption         =   "Print Report"
  44.       Height          =   495
  45.       Left            =   2160
  46.       TabIndex        =   3
  47.       Top             =   3960
  48.       Width           =   3375
  49.    End
  50.    Begin VB.ComboBox OutputList 
  51.       Height          =   300
  52.       Left            =   2160
  53.       TabIndex        =   0
  54.       Text            =   "   "
  55.       Top             =   1680
  56.       Width           =   3735
  57.    End
  58.    Begin Crystal.CrystalReport Report1 
  59.       Left            =   7560
  60.       Top             =   600
  61.       _extentx        =   741
  62.       _extenty        =   741
  63.       _stockprops     =   0
  64.       reportfilename  =   ""
  65.       destination     =   0
  66.       windowleft      =   100
  67.       windowtop       =   100
  68.       windowwidth     =   490
  69.       windowheight    =   300
  70.       windowtitle     =   ""
  71.       windowborderstyle=   2
  72.       windowcontrolbox=   -1  'True
  73.       windowmaxbutton =   -1  'True
  74.       windowminbutton =   -1  'True
  75.       copiestoprinter =   1
  76.       printfilename   =   ""
  77.       printfiletype   =   0
  78.       selectionformula=   ""
  79.       groupselectionformula=   ""
  80.       connect         =   ""
  81.       username        =   ""
  82.    End
  83.    Begin VB.Label Label7 
  84.       Caption         =   "To:"
  85.       Height          =   255
  86.       Left            =   2880
  87.       TabIndex        =   8
  88.       Top             =   3000
  89.       Width           =   855
  90.    End
  91.    Begin VB.Label Label6 
  92.       Caption         =   "From:"
  93.       Height          =   255
  94.       Left            =   2880
  95.       TabIndex        =   7
  96.       Top             =   2520
  97.       Width           =   735
  98.    End
  99.    Begin VB.Label Label5 
  100.       Caption         =   "Order Number"
  101.       Height          =   255
  102.       Left            =   840
  103.       TabIndex        =   6
  104.       Top             =   2520
  105.       Width           =   1335
  106.    End
  107.    Begin VB.Label Label2 
  108.       Caption         =   "Print Destination"
  109.       Height          =   255
  110.       Left            =   360
  111.       TabIndex        =   5
  112.       Top             =   1680
  113.       Width           =   1695
  114.    End
  115.    Begin VB.Label Label1 
  116.       Caption         =   "Sample App using Crystal Reports Custom Control"
  117.       BeginProperty Font 
  118.          name            =   "MS Sans Serif"
  119.          charset         =   1
  120.          weight          =   700
  121.          size            =   13.5
  122.          underline       =   0   'False
  123.          italic          =   0   'False
  124.          strikethrough   =   0   'False
  125.       EndProperty
  126.       Height          =   375
  127.       Left            =   240
  128.       TabIndex        =   4
  129.       Top             =   600
  130.       Width           =   7935
  131.    End
  132. Attribute VB_Name = "Form1"
  133. Attribute VB_Creatable = False
  134. Attribute VB_Exposed = False
  135. Dim StrBuffer As String * 250
  136. Private Sub Form_Load()
  137.     OutputList.AddItem "Window"
  138.     OutputList.AddItem "Printer"
  139.     OutputList.AddItem "File"
  140.     OutputList.Text = "Window"
  141.     RangeStart.Text = "1"
  142.     RangeEnd.Text = "9999"
  143. End Sub
  144. Private Sub OutputList_Click()
  145.     If OutputList.Text = "Printer" Then
  146.         Form2.Show
  147.     Else
  148.         If OutputList.Text = "File" Then
  149.         Form3.Show
  150.         End If
  151.     End If
  152. End Sub
  153. Private Sub Print_Report_Click()
  154. '   Please note that several properties of Report1 have been set
  155. '   for this example. Select F4 ( Properties ) when the focus is on
  156. '   the Crystal Reports icon to view these properties.
  157. '   For Example, the ReportName property has been set
  158. '   to ocxmdb.rpt. This report file was included in the
  159. '   Reports directory.
  160. '   Set Report1 Destination property based on the output
  161. '   setting which the user has selected from the Combination
  162. '   box on the report entitled OutputList.
  163.     If OutputList.Text = "Window" Then
  164.         OutputDestination = 0
  165.     Else
  166.         If OutputList.Text = "Printer" Then
  167.             OutputDestination = 1
  168.             Report1.CopiesToPrinter = Number_Of_Copies
  169.         Else
  170.             If OutputList.Text = "File" Then
  171.                 OutputDestination = 2
  172.                 Report1.PrintFileName = Output_File_Name
  173.                 Report1.PrintFileType = Output_File_Type
  174.             End If
  175.         End If
  176.     End If
  177.     Report1.Destination = OutputDestination
  178. '   Set the Record Selection formula based on the Starting
  179. '   and ending ranges
  180.     FmlaText$ = "{detail.ORDERNUM} in '" + Trim(RangeStart.Text) + "' to '" + Trim(RangeEnd.Text) + "'"
  181.     Report1.SelectionFormula = FmlaText$
  182. '   Set location of the database file to the location from
  183. '   which the user ran the app
  184.     LocText$ = LCase(App.Path)
  185.     If Right$(App.Path, 1) <> "\" Then LocText$ = LocText$ + "\"  'handles the root
  186.     Report1.DataFiles(0) = LocText$ + "crystal.mdb"
  187.     Report1.ReportFileName = LocText$ + "ocxmdb.rpt"
  188. '   EXECUTE PRINT CALL
  189.     On Error GoTo ErrorHandler
  190.         Report1.Action = 1
  191.       Exit Sub
  192. ErrorHandler:
  193.     MsgBox Report1.LastErrorString
  194.    Exit Sub
  195.   End Sub
  196. Private Sub RangeEnd_GotFocus()
  197.     RangeEnd.SelStart = 0
  198.     RangeEnd.SelLength = Len(RangeEnd.Text)
  199. End Sub
  200. Private Sub RangeStart_GotFocus()
  201.     RangeStart.SelStart = 0
  202.     RangeStart.SelLength = Len(RangeStart.Text)
  203. End Sub
  204.