这是我的代码:
Private Sub tvw1_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvw1.AfterSelect
Dim MPath As String
MPath = "D:\VB6_Projects\ChurchPresentation\ChurchPresentation\Bible_TH\Bible1971\"
Dim str As String
Dim strArr() As String
Dim count As Integer
If tvw1.Nodes(0).Nodes(0).Nodes(0).IsSelected = True Then
rtbThai.LoadFile(MPath & "genesis1.txt", RichTextBoxStreamType.PlainText)
str = rtbThai.Text
strArr = str.Split(ChrW(10))
For count = 0 To strArr.Length - 1
lstThai1971.Controls.Add(strArr(count))
'MessageBox.Show(strArr(count))
Next
End If
End Sub
如果我显示消息框,它会起作用,如果我使用lstThai1971.Controls.add(strArr(count))
则不行。
此代码有什么问题?
答案 0 :(得分:1)
假设lstThai1971是一个ListBox,我希望你想:
[System.Collections.ArrayList]$text = gc C:\file.txt
$text.RemoveRange(4,1)
$text
您还可以使用 lstThai1971.Items.Add(strArr(count))
AddRange