Private Sub Form_Load()
Dim s As String
Open "d:\abc\123.txt" For Input As #1 '文件名自己改
List1.Clear
Do Until EOF(1)
Line Input #1, s
List1.AddItem s
Loop
Close #1
End Sub
Private List1_Click()
Text1.Text = Text1.Text & List1.Text
List1.RemoveItem List1.ListIndex
End Sub
放一个listbox 和一个text1,然后粘贴如下代码,(记得修改文本文件名称哦)
Private Sub Form_Load()
Dim DataValue() As Long
Dim i As Integer
Open "c:\1.txt" For Input As #1 '注意修改这里的文件名哦
Dim maxnum As Long
Do Until EOF(1) = True
Dim tmp As String
Input #1, tmp
List1.AddItem tmp
Loop
End Sub
Private Sub List1_Click()
If List1.ListCount > 0 Then
Text1.Text = List1.List(List1.ListIndex) '添加到文本框中
List1.RemoveItem (List1.ListIndex) '移除
End If
End Sub