home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / crystal / extras / vbvbx / main.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-02-10  |  9.9 KB  |  333 lines

  1. VERSION 2.00
  2. Begin Form main 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H00808000&
  5.    Caption         =   "Crystal VBX Application"
  6.    ClientHeight    =   4770
  7.    ClientLeft      =   1125
  8.    ClientTop       =   1740
  9.    ClientWidth     =   8085
  10.    ForeColor       =   &H00FF0000&
  11.    Height          =   5460
  12.    Icon            =   MAIN.FRX:0000
  13.    Left            =   1065
  14.    LinkTopic       =   "Form1"
  15.    ScaleHeight     =   4770
  16.    ScaleWidth      =   8085
  17.    Top             =   1110
  18.    Width           =   8205
  19.    Begin CrystalReport Report1 
  20.       BoundReportFooter=   0   'False
  21.       BoundReportHeading=   ""
  22.       Connect         =   ""
  23.       CopiesToPrinter =   1
  24.       Destination     =   0  'Window
  25.       DetailCopies    =   1
  26.       DiscardSavedData=   0   'False
  27.       EMailCCList     =   ""
  28.       EMailMessage    =   ""
  29.       EMailSubject    =   ""
  30.       EMailToList     =   ""
  31.       EMailVIMBCCList =   ""
  32.       GroupSelectionFormula=   ""
  33.       Left            =   7560
  34.       MarginBottom    =   0
  35.       MarginLeft      =   0
  36.       MarginRight     =   0
  37.       MarginTop       =   0
  38.       PrinterCollation=   2  'default
  39.       PrinterCopies   =   1
  40.       PrinterDriver   =   ""
  41.       PrinterName     =   ""
  42.       PrinterPort     =   ""
  43.       PrinterStartPage=   0
  44.       PrinterStopPage =   0
  45.       PrintFileCharSepQuote=   ""
  46.       PrintFileCharSepSeparator=   ""
  47.       PrintFileName   =   ""
  48.       PrintFileType   =   2  'Text
  49.       PrintFileUseRptDateFmt=   0   'False
  50.       PrintFileUseRptNumberFmt=   0   'False
  51.       ReportFileName  =   ""
  52.       ReportSource    =   0  'Report File
  53.       ReportTitle     =   ""
  54.       SelectionFormula=   ""
  55.       SessionHandle   =   0
  56.       SQLQuery        =   ""
  57.       Top             =   3720
  58.       UserName        =   ""
  59.       WindowBorderStyle=   2  'Sizable
  60.       WindowControlBox=   -1  'True
  61.       WindowControls  =   -1  'True
  62.       WindowHeight    =   300
  63.       WindowLeft      =   100
  64.       WindowMaxButton =   -1  'True
  65.       WindowMinButton =   -1  'True
  66.       WindowParentHandle=   0
  67.       WindowState     =   0  'normal
  68.       WindowTitle     =   ""
  69.       WindowTop       =   100
  70.       WindowWidth     =   480
  71.    End
  72.    Begin CommonDialog CMDialog2 
  73.       Left            =   7560
  74.       Top             =   2520
  75.    End
  76.    Begin PictureBox Picture1 
  77.       BackColor       =   &H00C0C000&
  78.       FillColor       =   &H00C0C000&
  79.       Height          =   1215
  80.       Left            =   3600
  81.       Picture         =   MAIN.FRX:0302
  82.       ScaleHeight     =   1185
  83.       ScaleWidth      =   1305
  84.       TabIndex        =   2
  85.       Top             =   1560
  86.       Width           =   1335
  87.    End
  88.    Begin SSPanel statusbar 
  89.       Align           =   2  'Align Bottom
  90.       Alignment       =   1  'Left Justify - MIDDLE
  91.       BackColor       =   &H00C0C0C0&
  92.       BevelInner      =   2  'Raised
  93.       Caption         =   "Ready:"
  94.       Font3D          =   0  'None
  95.       Height          =   420
  96.       Left            =   0
  97.       TabIndex        =   1
  98.       Top             =   4350
  99.       Width           =   8085
  100.    End
  101.    Begin CommandButton Command1 
  102.       Caption         =   "Print Report"
  103.       Height          =   495
  104.       Left            =   3600
  105.       TabIndex        =   0
  106.       Top             =   3600
  107.       Width           =   1335
  108.    End
  109.    Begin CommonDialog CMDialog1 
  110.       Left            =   7560
  111.       Top             =   3120
  112.    End
  113.    Begin Menu mnufilemain 
  114.       Caption         =   "&File"
  115.       Begin Menu mnuOpenPrintJob 
  116.          Caption         =   "Open PrintJob"
  117.       End
  118.       Begin Menu mnuClosePrintJob 
  119.          Caption         =   "&Close PrintJob"
  120.       End
  121.       Begin Menu mnuseperate2 
  122.          Caption         =   "-"
  123.       End
  124.       Begin Menu mnuExit 
  125.          Caption         =   "E&xit"
  126.       End
  127.    End
  128.    Begin Menu mnuDestination 
  129.       Caption         =   "&Destination"
  130.       Begin Menu mnuOutPutToWindow 
  131.          Caption         =   "&Window"
  132.       End
  133.       Begin Menu mnuOutPutToPrinter 
  134.          Caption         =   "&Printer..."
  135.       End
  136.       Begin Menu mnuOutPutToFile 
  137.          Caption         =   "&Export To..."
  138.       End
  139.    End
  140.    Begin Menu mnuOptions 
  141.       Caption         =   "&Options"
  142.       Begin Menu mnuselectionformula 
  143.          Caption         =   "Formulas..."
  144.       End
  145.       Begin Menu mnuseperator4 
  146.          Caption         =   "-"
  147.       End
  148.       Begin Menu mnuSetSQL 
  149.          Caption         =   "Set SQL Query"
  150.       End
  151.       Begin Menu mnuaccess 
  152.          Caption         =   "Access Security..."
  153.       End
  154.       Begin Menu mnuNthTableLogOn 
  155.          Caption         =   "SQL Logon..."
  156.       End
  157.       Begin Menu mnustoredprocs 
  158.          Caption         =   "Stored Procedures..."
  159.       End
  160.       Begin Menu mnuseperator5 
  161.          Caption         =   "-"
  162.       End
  163.       Begin Menu mnudatabaselocation 
  164.          Caption         =   "Set Location..."
  165.       End
  166.       Begin Menu mnuGraphs 
  167.          Caption         =   "Graphing..."
  168.       End
  169.       Begin Menu mnusort 
  170.          Caption         =   "Sorting Functions..."
  171.          Enabled         =   0   'False
  172.       End
  173.       Begin Menu mnuseperator6 
  174.          Caption         =   "-"
  175.       End
  176.       Begin Menu mnuGroupSelection 
  177.          Caption         =   "Group Selection..."
  178.          Enabled         =   0   'False
  179.       End
  180.       Begin Menu mnuseperator7 
  181.          Caption         =   "Formating..."
  182.          Enabled         =   0   'False
  183.          Begin Menu mnuPageMargins 
  184.             Caption         =   "Page Margins.."
  185.             Enabled         =   0   'False
  186.          End
  187.       End
  188.       Begin Menu mnuseperator8 
  189.          Caption         =   "-"
  190.       End
  191.       Begin Menu mnuprintoptions 
  192.          Caption         =   "Set Print Options..."
  193.          Enabled         =   0   'False
  194.       End
  195.    End
  196.    Begin Menu mnsHelp 
  197.       Caption         =   "&Help"
  198.       Begin Menu mnuhelp 
  199.          Caption         =   "About VB Basic"
  200.       End
  201.    End
  202. Sub Command1_Click ()
  203. Dim StartPrintJob As Integer
  204. On Error GoTo ErrorMsg
  205. Screen.MousePointer = 11  ' Change the mouse to an hourglass
  206. report1.Action = 1    'Start the print Job
  207. Screen.MousePointer = 0   'Change mouse back to default
  208. Exit Sub
  209. 'If PeGetErrorCode(jobnumber) <> 0 Then
  210.  '  result = MsgBox(GetErrorString(jobnumber), 0 + 48, "Print Engine Message")
  211.    'Display = MsgBox("Error:" & PEGetErrorCode(jobnumber)) 'This displays the error #
  212. 'End If
  213. ErrorMsg:
  214. infobox = MsgBox(report1.LastErrorString, 0 + 48, "VBX Error Message")
  215. Resume Next
  216. End Sub
  217. Sub Command2_Click ()
  218. End Sub
  219. Sub mnuaccess_Click ()
  220. accfrm.Show 1
  221. End Sub
  222. Sub mnuCloseEngine_Click ()
  223. If EngineOpened = 0 Then
  224.    display = MsgBox("Engine Already Closed!", 0 + 48, "Engine Message")
  225.    PeCloseEngine
  226.    EngineOpened = 0
  227.    display = MsgBox("Print Engine Closed!", 0 + 64, "Engine Message")
  228. End If
  229. End Sub
  230. Sub mnuClosePrintJob_Click ()
  231. report1.Action = 2
  232. statusbar.Caption = "Report Closed as Requested:"
  233. End Sub
  234. Sub mnudatabaselocation_Click ()
  235. setlocation.Show 1
  236. End Sub
  237. Sub mnuEngine_Click ()
  238. If peopenengine() = False Then
  239.    MsgBox ("Engine Failed to open")
  240.    MsgBox ("Engine Opened")
  241. End If
  242. End Sub
  243. Sub mnuExit_Click ()
  244.    End
  245. End Sub
  246. Sub MnuExportTo_Click ()
  247. End Sub
  248. Sub mnufile2_Click ()
  249. End Sub
  250. Sub mnuGraphs_Click ()
  251. Graph.Show 1
  252. End Sub
  253. Sub mnuGroupSelection_Click ()
  254. groupselection.Show 1
  255. End Sub
  256. Sub mnuhelp_Click ()
  257. display = MsgBox("A Sample Visual Basic Application using the Crystal.VBX of Crystal Reports Version 4.0." + Chr$(10) + Chr$(10) + "Developed: 1995, Colin Brown, Crystal Services", 0 + 64, "VB Basic")
  258. End Sub
  259. Sub mnuNthTableLogOn_Click ()
  260. nthtablelogon.Show 1
  261. End Sub
  262. Sub mnuOpenEngine_Click ()
  263. If EngineOpened = 1 Then
  264.    display = MsgBox("Engine Already Opened!", 0 + 48, "Engine Message")
  265.    If peopenengine() = False Then        'Open Print Engine
  266.       MsgBox ("Engine Failed to open")
  267.    Else
  268.       EngineOpened = 1      'Set Variable for PE Opened Pointer
  269.       display = MsgBox("Print Engine Opened!", 0 + 64, "Engine Message")
  270.    End If
  271. End If
  272. End Sub
  273. Sub mnuOpenPrintJob_Click ()
  274. Dim ErrorCode As Integer
  275. CMDialog1.Filter = "*.rpt files (*.rpt)|*.rpt|"
  276. CMDialog1.Action = 1
  277. reportname = CMDialog1.Filename
  278. Screen.MousePointer = 11
  279. report1.ReportFileName = reportname
  280. Screen.MousePointer = 1
  281. 'If jobnumber = False Then
  282.  ' Statusbar.Caption = "Report file not opened!"
  283.   'MsgBox ("Cannot Read Report File!  Error: " & PeGetErrorCode(jobnumber)), (16), ("Warning!")
  284.   'Else
  285.   statusbar.Caption = "Report " + reportname + " Opened"
  286.   'mnuDestination = True  'Enable OutPut to Window Option
  287. 'End If
  288. End Sub
  289. Sub mnuOutPutToFile_Click ()
  290. Exportto.Show 1
  291. End Sub
  292. Sub mnuOutPutToPrinter_Click ()
  293.     Cmdialog2.Action = 5
  294.     Copies = Cmdialog2.Copies
  295.     report1.PrinterCopies = Copies
  296.     report1.Destination = 1
  297.      MnuOutputToWindow.Checked = False
  298.      MnuOutPutToPrinter.Checked = True
  299.      MnuOutPutToFile.Checked = False
  300.      statusbar.Caption = "Output Destination set for: Printer"
  301. End Sub
  302. Sub mnuOutPutToWindow_Click ()
  303. 'MsgBox ("Not Implemented Yet!")
  304. report1.Destination = 0   'Set output to window
  305.      MnuOutputToWindow.Checked = True
  306.      MnuOutPutToPrinter.Checked = False
  307.      MnuOutPutToFile.Checked = False
  308.      statusbar.Caption = "Output Destination set for: Window"
  309. End Sub
  310. Sub mnuPageMargins_Click ()
  311. margins.Show 1
  312. End Sub
  313. Sub mnuPrinter_Click ()
  314. End Sub
  315. Sub mnuprintoptions_Click ()
  316. printoptions.Show 1
  317. End Sub
  318. Sub mnuselectionformula_Click ()
  319. selectionformula.Show 1
  320. End Sub
  321. Sub mnuSetSQL_Click ()
  322. sqlquery.Show 1
  323. End Sub
  324. Sub mnusort_Click ()
  325. Sorting.Show 1
  326. End Sub
  327. Sub mnustoredprocs_Click ()
  328. storedprocs.Show 1
  329. End Sub
  330. Sub mnutest_Click ()
  331. margins.Show 1
  332. End Sub
  333.