【发布时间】:2016-03-11 17:59:26
【问题描述】:
'我有一个列表框,我将多行文本文件复制到其中。我想删除每个列表项的前 20 个字符。我还想在源文件用新行更新时更新列表框的内容。列表框可能会替换我的文本框。任何帮助将不胜感激。
Try
Dim StrmRdr As New StreamReader("C:\Users\e70605\Desktop\alarms.txt")
Dim word As String = ""
Dim words(9999) As String
Dim i As Integer = 0
'this Do Until Loop was for a Listbox I initially started with
Do Until StrmRdr.Peek = -1
'catch a word at a time file file
word = StrmRdr.ReadLine()
'send readline into words
words(i) = word
'tell where the word should go to
ListBox1.Items.Add(words(i))
'go to the next line. until lines are finished.
i = i + 1
Loop
【问题讨论】:
-
您忘记描述问题并提出问题。
-
你好 Plutonix。我没听清楚,拜托。
标签: vb.net listbox streamreader readline