程序代码
Private Sub Command1_Click() '从根目录导入到text
Open App.Path & "\123.txt" For Binary As #1
Text1.Text = Input(LOF(1), 1)
Close #1
End Sub
Private Sub Command2_Click() '从根目录导入到list
Dim a As String
Open App.Path & "\123.txt" For Binary As #1
a = Input(LOF(1), 1)
Close #1
'-------------------------------------------导入变量
List1.Clear
Dim b() As String
Dim c As Integer
b = Split(a, vbCrLf)
For c = LBound(b) To UBound(b)
List1.AddItem b(c)
Next c
'-------------------------------------------分行导入
End Sub
Private Sub Command3_Click() 'Text导入到list
List1.Clear
Dim b() As String
Dim c As Integer
b = Split(Text1.Text, vbCrLf)
For c = LBound(b) To UBound(b)
List1.AddItem b(c)
Next c
End Sub
Private Sub Command4_Click() 'list导入到Text
Dim a As Integer
Dim b As String
For a = 0 To List1.ListCount - 1
b = b & List1.List(a) & vbCrLf
Next a
Text1.Text = b
End Sub