VERSION 5.00
Begin VB.Form FrmSetSerial 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Set Serial"
   ClientHeight    =   2250
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4080
   BeginProperty Font 
      Name            =   "Times New Roman"
      Size            =   14.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   MouseIcon       =   "FrmSetSerial.frx":0000
   ScaleHeight     =   2250
   ScaleWidth      =   4080
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton CmdTest 
      Caption         =   "Test"
      Height          =   495
      Left            =   120
      TabIndex        =   8
      Top             =   1560
      Width           =   1215
   End
   Begin VB.CommandButton CmdCancel 
      Caption         =   "Cancel"
      Height          =   495
      Left            =   2760
      TabIndex        =   7
      Top             =   1560
      Width           =   1215
   End
   Begin VB.CommandButton CmdOK 
      Caption         =   "OK"
      Height          =   495
      Left            =   1440
      TabIndex        =   6
      Top             =   1560
      Width           =   1215
   End
   Begin VB.TextBox TxtDeviceNumber 
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   11.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      IMEMode         =   2  'OFF
      Left            =   2160
      MaxLength       =   3
      TabIndex        =   3
      Text            =   "1"
      Top             =   1080
      Width           =   1815
   End
   Begin VB.ComboBox CmbBPS 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      ItemData        =   "FrmSetSerial.frx":08CA
      Left            =   2160
      List            =   "FrmSetSerial.frx":08D7
      Style           =   2  'Dropdown List
      TabIndex        =   1
      Top             =   600
      Width           =   1815
   End
   Begin VB.ComboBox CmbComProt 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      ItemData        =   "FrmSetSerial.frx":08EF
      Left            =   2160
      List            =   "FrmSetSerial.frx":08FF
      Style           =   2  'Dropdown List
      TabIndex        =   0
      Top             =   120
      Width           =   1815
   End
   Begin VB.Label lblComPort 
      Alignment       =   1  'Right Justify
      Caption         =   "ComPort:"
      Height          =   255
      Left            =   120
      TabIndex        =   5
      Top             =   120
      Width           =   1815
   End
   Begin VB.Label lblDeviceNubmer 
      Alignment       =   1  'Right Justify
      Caption         =   "Device Number:"
      Height          =   255
      Left            =   120
      TabIndex        =   4
      Top             =   1080
      Width           =   1815
   End
   Begin VB.Label lblBps 
      Alignment       =   1  'Right Justify
      Caption         =   "BPS:"
      Height          =   255
      Left            =   120
      TabIndex        =   2
      Top             =   600
      Width           =   1815
   End
End
Attribute VB_Name = "FrmSetSerial"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub CmdCancel_Click()
    Unload Me
End Sub

Private Sub CmdOK_Click()
    If Not MDIFrm.BFLex1.OpenCom(CmbComProt.Text, CLng(CmbBPS.Text)) Then
        MsgBox "Com Port can't open!"
        Exit Sub
    End If
    Call MDIFrm.BFLex1.SelectDevice(BFLex389_Device)
    MdlVar.PCCom = CmbComProt.Text
    MdlVar.DeviceNumber = CLng(TxtDeviceNumber.Text)
    Unload Me
End Sub

Private Sub CmdTest_Click()
    If Not MDIFrm.BFLex1.OpenCom(CmbComProt.Text, CLng(CmbBPS.Text), "") Then
        MsgBox "Com Port can't open!"
        Exit Sub
    End If
    Call MDIFrm.BFLex1.SelectDevice(BFLex389_Device)
    If MDIFrm.BFLex1.Test(CLng(TxtDeviceNumber.Text)) Then
        MsgBox "Connect Device Succeed"
    Else
        MsgBox "Connect Device Fail,Please check Comport and Bps of value"
    End If
    MDIFrm.BFLex1.CloseCom
End Sub

Private Sub Form_Load()
    CmbComProt.ListIndex = 0
    CmbBPS.ListIndex = 1
    TxtDeviceNumber.Text = 1
End Sub
