字节与字符.frm

来自「一个VB通讯不错的程序」· FRM 代码 · 共 98 行

FRM
98
字号
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4560
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6960
   LinkTopic       =   "Form1"
   ScaleHeight     =   4560
   ScaleWidth      =   6960
   StartUpPosition =   3  '窗口缺省
   Begin MSCommLib.MSComm MSComm1 
      Left            =   600
      Top             =   3360
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
      RThreshold      =   1
      InputMode       =   1
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   2760
      TabIndex        =   4
      Text            =   "1"
      Top             =   1920
      Width           =   615
   End
   Begin VB.CommandButton Command2 
      Caption         =   "END"
      Height          =   495
      Left            =   3840
      TabIndex        =   3
      Top             =   2640
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "SEND"
      Height          =   495
      Left            =   1320
      TabIndex        =   2
      Top             =   2640
      Width           =   1335
   End
   Begin VB.TextBox Text2 
      Height          =   855
      Left            =   3600
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   1
      Top             =   600
      Width           =   2295
   End
   Begin VB.TextBox Text1 
      Height          =   855
      Left            =   480
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   0
      Top             =   600
      Width           =   2175
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
MSComm1.Output = Text1.Text

End Sub

Private Sub Command2_Click()
MSComm1.PortOpen = False
End
End Sub

Private Sub Form_Load()
MSComm1.PortOpen = True
MSComm1.RThreshold = Val(Text3.Text)

End Sub

Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
  Case comEvReceive
    Text2.Text = Text2.Text + Trim(MSComm1.Input)
    End Select
  
End Sub

Private Sub Text3_Change()
MSComm1.RThreshold = Val(Text3.Text)
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?