VB 把一个未知的整数型变量 存到一个数组 在分别提取数组里的元素 分别显示

2024-11-15 18:54:21
推荐回答(1个)
回答1:

Dim HK As String
Dim A() As String
Private Sub Command1_Click()
MSComm1.Output = Text2.Text
End Sub

Private Sub Form_Load()

Dim i, j As Integer
MSComm1.CommPort = 1

MSComm1.PortOpen = True
MSComm1.InputMode = comInputModeText

MSComm1.RThreshold = 1
MSComm1.InputLen = 1
MSComm1.EOFEnable = True
End Sub

Private Sub Timer1_Timer()
i = i + 1
ReDim Preserve A(i)
A(i) = MSComm1.Input
For j = 1 To i

Text1.Text = Text1.Text & A(j)
Next
End Sub
直键迹接运行就可,看看是不是你稿裤并要的结果纯清