VERSION 5.00
Begin VB.Form FrmSetNet 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Set Net"
   ClientHeight    =   2310
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4470
   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
   ScaleHeight     =   2310
   ScaleWidth      =   4470
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command1 
      Caption         =   "Test ver2.0"
      Height          =   735
      Left            =   1080
      TabIndex        =   9
      Top             =   1440
      Width           =   1095
   End
   Begin VB.TextBox txtPort 
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   10.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   2160
      MaxLength       =   5
      TabIndex        =   7
      Text            =   "5010"
      Top             =   600
      Width           =   2175
   End
   Begin VB.CommandButton CmdTest 
      Caption         =   "Test ver1.0"
      Height          =   735
      Left            =   0
      TabIndex        =   6
      Top             =   1440
      Width           =   1095
   End
   Begin VB.CommandButton CmdCancel 
      Caption         =   "Cancel"
      Height          =   495
      Left            =   3360
      TabIndex        =   5
      Top             =   1680
      Width           =   975
   End
   Begin VB.CommandButton CmdOK 
      Caption         =   "OK"
      Height          =   495
      Left            =   2400
      TabIndex        =   4
      Top             =   1680
      Width           =   855
   End
   Begin VB.TextBox TxtDeviceNumber 
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   10.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   2160
      MaxLength       =   3
      TabIndex        =   3
      Text            =   "1"
      Top             =   1080
      Width           =   2175
   End
   Begin VB.TextBox TxtIPAddress 
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   10.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   2160
      MaxLength       =   16
      TabIndex        =   2
      Text            =   "192.168.1.100"
      Top             =   120
      Width           =   2175
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      Caption         =   "Port"
      Height          =   255
      Left            =   120
      TabIndex        =   8
      Top             =   600
      Width           =   1935
   End
   Begin VB.Label lblDeviceNubmer 
      Alignment       =   1  'Right Justify
      Caption         =   "Device Nubmer:"
      Height          =   255
      Left            =   120
      TabIndex        =   1
      Top             =   1080
      Width           =   1935
   End
   Begin VB.Label lblIpAddress 
      Alignment       =   1  'Right Justify
      Caption         =   "IP Address:"
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   1935
   End
End
Attribute VB_Name = "FrmSetNet"
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.OpenNet() Then
        MsgBox "Opened Net port error!"
        Exit Sub
    End If
    Call MDIFrm.BFLex1.OpenNet(BFLex_Net_TCP)
    If Not MDIFrm.BFLex1.SetIPAddress(TxtIPAddress.Text, CLng(txtPort.Text)) Then
        MsgBox "Please check ip address format"
        Exit Sub
    End If
    Call MDIFrm.BFLex1.SelectDevice(BFLex390_Device)
    MdlVar.DeviceNumber = CLng(TxtDeviceNumber.Text)
    Unload Me
 End Sub

Private Sub CmdTest_Click()
    MsgBox "1, start to open the NET port"
    If Not MDIFrm.BFLex1.OpenNet() Then
        MsgBox "Opened Net port error!"
        Exit Sub
    End If
    MsgBox "2, start to set the ip address "
    Call MDIFrm.BFLex1.OpenNet(BFLex_Net_TCP)
    If Not MDIFrm.BFLex1.SetIPAddress(TxtIPAddress.Text, CLng(txtPort.Text)) Then
        MsgBox "Please check ip address format"
        Exit Sub
    End If
    Call MDIFrm.BFLex1.SelectDevice(BFLex389_Device)
    MsgBox " 3, start to test the device via tcp/ip"
    If MDIFrm.BFLex1.Test(CLng(TxtDeviceNumber.Text)) Then
        MsgBox "Connect Device Succeed"
    Else
        MsgBox "Connect Device Fail,Please check IP address"
    End If
    MDIFrm.BFLex1.CloseNet
End Sub

Private Sub Command1_Click()
    MsgBox "1, start to open the NET port"
    If Not MDIFrm.BFLex1.OpenNet() Then
        MsgBox "Opened Net port error!"
        Exit Sub
    End If
    MsgBox "2, start to set the ip address "
    Call MDIFrm.BFLex1.OpenNet(BFLex_Net_TCP)
    If Not MDIFrm.BFLex1.SetIPAddress(TxtIPAddress.Text, CLng(txtPort.Text)) Then
        MsgBox "Please check ip address format"
        Exit Sub
    End If
    Call MDIFrm.BFLex1.SelectDevice(BFLex390_Device)
    MsgBox " 3, start to test the device via tcp/ip"
    If MDIFrm.BFLex1.Test(CLng(TxtDeviceNumber.Text)) Then
        MsgBox "Connect Device Succeed"
    Else
        MsgBox "Connect Device Fail,Please check IP address"
    End If
    MDIFrm.BFLex1.CloseNet

End Sub
