VERSION 5.00
Object = "{A26A3C1E-9DC9-11D3-9DB9-0000E8DBEDCE}#5.2#0"; "PDX1C.dll"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "comctl32.ocx"
Begin VB.Form MainForm 
   Caption         =   "SamplePDX"
   ClientHeight    =   3810
   ClientLeft      =   1665
   ClientTop       =   2940
   ClientWidth     =   7950
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   3810
   ScaleWidth      =   7950
   Begin PDX1C.PDX45 fPDX 
      Left            =   4320
      Top             =   3000
      CurrentDeviceIndex=   0
      CurrentDeviceNumber=   1
      CurrentDeviceName=   "PDL"
      ApplicationHandle=   0
      RaiseException  =   -1  'True
      PortNumber      =   1
      BaudRate        =   18
      Parity          =   0
      DataBits        =   4
      StopBits        =   0
      FormNumber      =   0
      LockDevices     =   0   'False
      DeviceEnabled   =   0   'False
      ShowProgress    =   -1  'True
      MachineName     =   ""
      Model           =   4
      ReportFieldIndex=   0
      Delimiter       =   ","
      EventData       =   ""
      ReportParserEnabled=   -1  'True
      FileName        =   ""
      ReportField     =   ""
      FileType        =   0
      FieldDataEnabled=   -1  'True
   End
   Begin ComctlLib.ListView List 
      Height          =   2655
      Left            =   120
      TabIndex        =   7
      Top             =   120
      Width           =   7695
      _ExtentX        =   13573
      _ExtentY        =   4683
      View            =   3
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      _Version        =   327682
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   0
   End
   Begin VB.ComboBox NumberOfForm 
      Height          =   315
      IntegralHeight  =   0   'False
      Left            =   3360
      Style           =   2  'Dropdown List
      TabIndex        =   6
      Top             =   2880
      Width           =   735
   End
   Begin VB.CommandButton WriteData 
      Caption         =   " "
      Height          =   375
      Left            =   120
      TabIndex        =   4
      Top             =   3360
      Width           =   1935
   End
   Begin VB.CommandButton Exit 
      Caption         =   ""
      Height          =   375
      Left            =   6240
      TabIndex        =   3
      Top             =   3360
      Width           =   1575
   End
   Begin VB.CheckBox Enable 
      Caption         =   " "
      Height          =   195
      Left            =   2160
      TabIndex        =   2
      Top             =   3480
      Width           =   2175
   End
   Begin VB.CommandButton ShowProperties 
      Caption         =   " "
      Height          =   375
      Left            =   6240
      TabIndex        =   1
      Top             =   2880
      Width           =   1575
   End
   Begin VB.CommandButton ReadData 
      Caption         =   " "
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   2880
      Width           =   1935
   End
   Begin VB.Label Label2 
      Caption         =   " :"
      Height          =   255
      Left            =   2160
      TabIndex        =   5
      Top             =   2940
      Width           =   1215
   End
End
Attribute VB_Name = "MainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'/////////////////////////////////////////////////////
'//       //
'// .                                         //
'// ----------------------------------------------  //
'//                           //
'/////////////////////////////////////////////////////
'//  ,     //
'//   ,      //
'//   (   - //
'//   .                                //
'/////////////////////////////////////////////////////

Dim nFields As Long     '  

'''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Enable_Click()
    On Error GoTo ErrorHandler
    ' / 
    fPDX.DeviceEnabled = Enable.Value
Exit Sub
    
'   
ErrorHandler:
    If fPDX.ResultCode = 0 Then
        MsgBox (" Visual Basic: " + Err.Description)
        Exit Sub
    Else
        MsgBox fPDX.ResultDescription
        Enable.Value = fPDX.DeviceEnabled
    End If
End Sub
    
Private Sub Exit_Click()
    End
End Sub

Private Sub Form_Load()
    nFields = 0
    fPDX.RaiseException = True
    UpdateForm
    
    '    
    For I = 0 To 15
       NumberOfForm.AddItem (I)
    Next I
    NumberOfForm.ListIndex = 0
End Sub

Private Sub UpdateForm()
    '    
    If (fPDX.DeviceEnabled = True) Then
       Enable.Value = 1
    Else
       Enable.Value = 0
    End If
    
    If (nFields > 0) Then
        WriteData.Enabled = True
    Else
        WriteData.Enabled = False
    End If
    
End Sub
Private Sub NumberOfForm_DropDown()
   '    -  
   '  
   nFields = 0
   UpdateForm
End Sub

Private Sub ReadData_Click()
    On Error GoTo ErrorHandler
    
    '  
    fPDX.FormNumber = NumberOfForm.ListIndex
    fPDX.BeginReport
    
    '  ,  
    List.ListItems.Clear
    '    
    nFields = fPDX.ReportFieldCount
    List.ColumnHeaders.Clear
    For I = 0 To nFields - 1
        fPDX.ReportFieldIndex = I
        Call List.ColumnHeaders.Add(I + 1, , fPDX.ReportFieldName, 1200)
    Next I

    For J = 1 To fPDX.ReportRecordCount
        fPDX.GetRecord
        
        fPDX.ReportFieldIndex = 0
        Set li = List.ListItems.Add(J, , fPDX.ReportField)
        
        '    
        For I = 1 To nFields - 1
            fPDX.ReportFieldIndex = I
            li.SubItems(I) = fPDX.ReportField
        Next I
    Next J
    
    fPDX.EndReport
    UpdateForm
Exit Sub
    
'   
ErrorHandler:
    If (fPDX.ResultCode = 0) Then
        MsgBox (" Visual Basic: " + Err.Description)
        Exit Sub
    End If
    
    MsgBox fPDX.ResultDescription
End Sub

Private Sub ShowProperties_Click()
    '   
    fPDX.ShowProperties
End Sub

Private Sub WriteData_Click()
   Dim Value As String
   
   On Error GoTo ErrorHandler
   '      
   fPDX.BeginAdd
   '     
   For I = 1 To 10 '   
      For J = 0 To 6 '   6 ,    16 ( 0..15)
        fPDX.ReportFieldIndex = J
        fPDX.ReportField = Str(I) '   ,       
      Next J
      fPDX.SetRecord
   Next I
   
   fPDX.EndAdd
   UpdateForm
   Exit Sub
   
ErrorHandler:
    If (fPDX.ResultCode = 0) Then
        MsgBox (" Visual Basic: " + Err.Description)
        Exit Sub
    End If
    
    MsgBox fPDX.ResultDescription
End Sub
   

