VB 如何将文本文件内容读取到listbox?
展开全部
Private Sub Form_Load()
Dim appdisk As String
Dim aa As String
Dim i As Integer
appdisk = Trim(App.Path)
If Right(appdisk, 1) <> "\" Then appdisk = appdisk & "\"
fname = appdisk & "test.txt"
Open fname For Input As #1
Do Until EOF(1)
Line Input #1, aa
List1.AddItem aa, i
i = i + 1
Loop
Close #1
End Sub
Dim appdisk As String
Dim aa As String
Dim i As Integer
appdisk = Trim(App.Path)
If Right(appdisk, 1) <> "\" Then appdisk = appdisk & "\"
fname = appdisk & "test.txt"
Open fname For Input As #1
Do Until EOF(1)
Line Input #1, aa
List1.AddItem aa, i
i = i + 1
Loop
Close #1
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询