-- 作者:新福星
-- 发布时间:2019/11/15 11:59:00
--
Dim s As Row=Tables("串口属性").Current If s Is Nothing Then MessageBox.Show("没有指定端口无法打开!") Return End If
Ports.Add(s("PortName")) Ports(s("PortName")).Close()
Dim dyzf2 As Encoding= [Enum].Parse(Gettype(Encoding),s("Encoding"),True) Ports(s("PortName")).Encoding =dyzf2
Dim dyzf3 As Parity= [Enum].Parse(Gettype(Parity), s("Parity"), True) Ports(s("PortName")).Parity =dyzf3
Dim dyzf1 As Handshake= [Enum].Parse(Gettype(Handshake), s("Handshake"), True) Ports(s("PortName")).Handshake =dyzf1
Dim dyzf4 As StopBits= [Enum].Parse(Gettype(StopBits), s("StopBits"), True) Ports(s("PortName")).StopBits =dyzf4
\'Ports("COM2").Encoding = Encoding.Unicode
Ports(s("PortName")).BaudRate = cint(s("BaudRate")) Ports(s("PortName")).DataBits = s("DataBits") Ports(s("PortName")).ReadBufferSize() = s("ReadBufferSize") Ports(s("PortName")).WriteBufferSize() = s("WriteBufferSize") Ports(s("PortName")).Open
MessageBox.Show(s("PortName") & "设置完毕!")
|