界面如图
代码如下
Public Class Form3
Inherits System.Windows.Forms.Form
'广州荣士电子有限公司,联系电话020-82318861,82322852,定制13826029618 网址http://www.icmcu.com
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents ListView1 As System.Windows.Forms.ListView
Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Button6 As System.Windows.Forms.Button
Friend WithEvents Button7 As System.Windows.Forms.Button
Friend WithEvents Button8 As System.Windows.Forms.Button
Friend WithEvents Button9 As System.Windows.Forms.Button
Friend WithEvents DriveListBox1 As Microsoft.VisualBasic.Compatibility.VB6.DriveListBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Button2 = New System.Windows.Forms.Button
Me.ListView1 = New System.Windows.Forms.ListView
Me.ProgressBar1 = New System.Windows.Forms.ProgressBar
Me.Button3 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.Button5 = New System.Windows.Forms.Button
Me.Button6 = New System.Windows.Forms.Button
Me.Button7 = New System.Windows.Forms.Button
Me.Button8 = New System.Windows.Forms.Button
Me.Button9 = New System.Windows.Forms.Button
Me.DriveListBox1 = New Microsoft.VisualBasic.Compatibility.VB6.DriveListBox
Me.Label3 = New System.Windows.Forms.Label
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(8, 64)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(88, 32)
Me.Button1.TabIndex = 0
Me.Button1.Text = "增加挂失>>"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(152, 16)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = "0"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(72, 16)
Me.Label1.TabIndex = 2
Me.Label1.Text = "挂失管理"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(96, 16)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(56, 23)
Me.Label2.TabIndex = 3
Me.Label2.Text = "总挂失数"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(672, 72)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(192, 40)
Me.Button2.TabIndex = 4
Me.Button2.Text = "覆盖式发送左边列表中所有挂失卡号至设备"
'
'ListView1
'
Me.ListView1.ForeColor = System.Drawing.SystemColors.WindowText
Me.ListView1.Location = New System.Drawing.Point(120, 64)
Me.ListView1.Name = "ListView1"
Me.ListView1.Size = New System.Drawing.Size(536, 280)
Me.ListView1.TabIndex = 5
Me.ListView1.View = System.Windows.Forms.View.List
'
'ProgressBar1
'
Me.ProgressBar1.Location = New System.Drawing.Point(504, 16)
Me.ProgressBar1.Name = "ProgressBar1"
Me.ProgressBar1.Size = New System.Drawing.Size(224, 23)
Me.ProgressBar1.TabIndex = 6
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(8, 112)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(88, 32)
Me.Button3.TabIndex = 7
Me.Button3.Text = "清 空"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(672, 144)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(192, 40)
Me.Button4.TabIndex = 8
Me.Button4.Text = "<<从设备中读取所有挂失信息"
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(672, 224)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(72, 32)
Me.Button5.TabIndex = 9
Me.Button5.Text = "刷 新"
'
'Button6
'
Me.Button6.Location = New System.Drawing.Point(672, 296)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(184, 40)
Me.Button6.TabIndex = 10
Me.Button6.Text = "写所以挂失信息至U盘或磁盘"
'
'Button7
'
Me.Button7.Location = New System.Drawing.Point(496, 368)
Me.Button7.Name = "Button7"
Me.Button7.Size = New System.Drawing.Size(144, 40)
Me.Button7.TabIndex = 11
Me.Button7.Text = "从设备中查询卡号是否已被挂失"
'
'Button8
'
Me.Button8.Location = New System.Drawing.Point(312, 368)
Me.Button8.Name = "Button8"
Me.Button8.Size = New System.Drawing.Size(136, 40)
Me.Button8.TabIndex = 12
Me.Button8.Text = "追加式挂失单个卡号至设备"
'
'Button9
'
Me.Button9.Location = New System.Drawing.Point(136, 368)
Me.Button9.Name = "Button9"
Me.Button9.Size = New System.Drawing.Size(144, 40)
Me.Button9.TabIndex = 13
Me.Button9.Text = "追加式从设备取消单个卡号挂失"
'
'DriveListBox1
'
Me.DriveListBox1.Location = New System.Drawing.Point(768, 232)
Me.DriveListBox1.Name = "DriveListBox1"
Me.DriveListBox1.Size = New System.Drawing.Size(88, 22)
Me.DriveListBox1.TabIndex = 14
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(16, 336)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(56, 16)
Me.Label3.TabIndex = 15
Me.Label3.Text = "卡号:"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(16, 368)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.TabIndex = 16
Me.TextBox2.Text = "12"
'
'Form3
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(888, 430)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.DriveListBox1)
Me.Controls.Add(Me.Button9)
Me.Controls.Add(Me.Button8)
Me.Controls.Add(Me.Button7)
Me.Controls.Add(Me.Button6)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.ProgressBar1)
Me.Controls.Add(Me.ListView1)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button1)
Me.Name = "Form3"
Me.Text = "Form3"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strls As String
strls = InputBox("请输入卡号,必须为小于65535的数字")
ListView1.Items.Add(strls)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim f3 As Form1
Dim i As Long
f3 = Me.Owner
If f3.AxPOS011.DevComPortOpen = 1 Then
f3.AxPOS011.DevLossClearFromBuf() '先清空缓冲
For i = 1 To ListView1.Items.Count
f3.AxPOS011.CardCustomNumberStr = ListView1.Items(i).ToString
f3.AxPOS011.DevLossAddToBuf() '加入挂失信息缓冲
Next
f3.AxPOS011.DevNumber = CLng(f3.TextBox18.Text)
ProgressBar1.Maximum = f3.AxPOS011.DevLossFrames
ProgressBar1.Value = 0
For i = 0 To f3.AxPOS011.DevLossFrames - 1
f3.AxPOS011.DevLossFramePoint = i
f3.AxPOS011.DevLossFrameWrite()
If f3.AxPOS011.OperatingResults <> 0 Then
Exit For
Else
ProgressBar1.Value = i + 1
End If
Next i
If f3.AxPOS011.OperatingResults = 0 Then
MsgBox("下载挂失信息成功!")
Else
MsgBox(f3.AxPOS011.OperatingResults)
End If
Else
MsgBox("端口未打开!")
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim i As Long
Dim f3 As Form1
f3 = Me.Owner
If f3.AxPOS011.DevComPortOpen = 1 Then
f3.AxPOS011.DevNumber = CLng(f3.TextBox18.Text)
ProgressBar1.Maximum() = f3.AxPOS011.DevLossFrames
ProgressBar1.Value = 0
For i = 0 To f3.AxPOS011.DevLossFrames - 1
f3.AxPOS011.DevLossFramePoint = i
f3.AxPOS011.DevLossFrameRead()
If f3.AxPOS011.OperatingResults <> 0 Then
Exit For
Else
ProgressBar1.Value = i + 1
End If
Next i
If f3.AxPOS011.OperatingResults = 0 Then
If (f3.AxPOS011.DevLossBufSize > 0) Then
For i = 0 To f3.AxPOS011.DevLossBufSize - 1
f3.AxPOS011.DevLossBufPoint = i
ListView1.Items.Add(f3.AxPOS011.CardCustomNumberStr)
Next i
End If
MsgBox("提取挂失信息成功!")
Else
MsgBox(f3.AxPOS011.OperatingResults)
End If
Else
MsgBox("端口未打开!")
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
ListView1.Items.Clear()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
DriveListBox1.Refresh()
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim f3 As Form1
f3 = Me.Owner
Dim i As Short
f3.AxPOS011.DevLossClearFromBuf() '先清空缓冲
For i = 1 To ListView1.Items.Count
f3.AxPOS011.CardCustomNumberStr = ListView1.Items(i).ToString
f3.AxPOS011.DevLossAddToBuf() '加入挂失信息缓冲
Next
f3.AxPOS011.DevDriverStr = DriveListBox1.Drive
f3.AxPOS011.DevLossWriteAllToDisk()
If f3.AxPOS011.OperatingResults = 0 Then
MsgBox("写覆盖式挂失信息到U盘或磁盘成功!")
Else
MsgBox(f3.AxPOS011.OperatingResults)
End If
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim f3 As Form1
f3 = Me.Owner
If f3.AxPOS011.DevComPortOpen = 1 Then
f3.AxPOS011.DevNumber = CLng(f3.TextBox18.Text)
f3.AxPOS011.CardCustomNumberStr = TextBox2.Text '自编卡号
f3.AxPOS011.DevLossBitRead()
If f3.AxPOS011.OperatingResults = 0 Then
MsgBox("该卡号已被挂失!")
ElseIf f3.AxPOS011.OperatingResults = 113 Then
MsgBox("该卡号可使用!")
Else
MsgBox("设备通讯不通!")
End If
Else
MsgBox("端口未打开!")
End If
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim f3 As Form1
f3 = Me.Owner
If f3.AxPOS011.DevComPortOpen = 1 Then
f3.AxPOS011.DevNumber = CLng(f3.TextBox18.Text)
f3.AxPOS011.CardCustomNumberStr = TextBox2.Text '自编卡号
f3.AxPOS011.DevLossBitWrite()
If f3.AxPOS011.OperatingResults = 0 Then
MsgBox("挂失单张卡号成功!")
Else
MsgBox("设备通讯不通!")
End If
Else
MsgBox("端口未打开!")
End If
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Dim f3 As Form1
f3 = Me.Owner
If f3.AxPOS011.DevComPortOpen = 1 Then
f3.AxPOS011.DevNumber = CLng(f3.TextBox18.Text) '指定设备号
f3.AxPOS011.CardCustomNumberStr = TextBox2.Text '自编卡号
f3.AxPOS011.DevLossBitClear() '在设备中清空该卡号的挂失信息
If f3.AxPOS011.OperatingResults = 0 Then
MsgBox("取消单张卡号成功!")
Else
MsgBox("设备通讯不通!")
End If
Else
MsgBox("端口未打开!")
End If
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class