mscomm1.output="abcdefg" +vbCr 由回车改为 ctrl+z怎么写?

zhoupq 2003-11-09 03:58:00
mscomm1.output="abcdefg" +vbCr 由回车改为 ctrl+z怎么写?
...全文
30 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
jpinglee 2003-12-02
  • 打赏
  • 举报
回复
mscomm1.output="abcdefg" +chr(26)
ctrl+z的键值为26
'-----发送按钮Click事件子程序----------- Private Sub Fasong_Click() Dim JIHAO(0) As Byte ’机号 Dim head_data(4) As Byte ’5 Byte控制字 Dim end_data(0) As Byte '1 Byte 结束字 JIHAO(0) = Val(Text3.Text) head_data(0) = Val(Text4.Text) head_data(2) = &HEE 'TIMH head_data(3) = &HEE 'TIML head_data(4) = Val(Combo1.Text) 'INMOD end_data(0) = &HFF If Combo2.Text = "增加" Then head_data(1) = &H99 If Combo2.Text = "清空" Then head_data(1) = &H33 If Combo2.Text = "删除" Then head_data(1) = &H32 Ready = 0: ErrCount = 0 On Error GoTo ERRORCOM ’打开错误处理 '---------------------------------------------------------- If com1.value Then MSComm1.CommPort = 1 'Use com1 If com2.value Then MSComm1.CommPort = 2 'Use com2 MSComm1.Settings = FORM1.Combo3.Text + ",M,8,2" '设定波特率和置校验和位为1 MSComm1.InputLen = 0 ' MSComm1.PortOpen = -1 'Open the port MSComm1.OutBufferCount = 0 MSComm1.Output = JIHAO ‘发送机号 MSComm1.PortOpen = False ’关闭串口 MSComm1.Settings = FORM1.Combo3.Text + ",S,8,2" '设定波特率和置校验和位为空 MSComm1.OutBufferCount = 0 MSComm1.PortOpen = True MSComm1.Output = head_data MSComm1.Output = Text2.Text MSComm1.Output = end_data MSComm1.PortOpen = False Text1.Text = "发送成功!" + Chr(13) & Chr(10) + "发送至" + Text3.Text + "屏体," + "信息编号:" + Text4.Text + Chr(13) & Chr(10) + Chr(13) & Chr(10) + Text1.Text GoTo comend ERRORCOM: Text1.Text = "ERROR!请重新选择COM口!" + Chr(13) & Chr(10) + Chr(13) & Chr(10) + Text1.Text comend: On Error GoTo 0 End Sub

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧