-- 作者:fanwei1111
-- 发布时间:2012/8/11 16:31:00
--
感觉问题在读卡器发送数据时,发送一次数据都是分两次接收数据(除了刚打开项目第一次接收外),代码如下:
项目事件
DataReceived
Forms("窗口1").Controls("TextBox1").Text = e.Port.ReadExisting()
AfterOpenProject
Ports.Add("COM1")
With Ports("COM1")
.Close()
.Parity = Parity.None
.Handshake = Handshake.None
.StopBits = StopBits.One
.BaudRate = 9600
.DataBits = 8
.ReadBufferSize() = 4096
.WriteBufferSize() = 2048
.Open
End With
Ports("COM1").Open()
窗口与控件事件
窗口1_TextBox1_ValueChanged
Dim rab As String
rab = Forms("窗口1").Controls("TextBox1").Text
Dim r As Row
r = Tables("称重数据").AddNew()
r("key") = rab
|