Reputation: 13
Here is my code:
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
It works if I show the messagebox, buf it doesn’t if I use lstThai1971.Controls.add(strArr(count))
.
What is wrong in this code?
Upvotes: 1
Views: 255
Reputation: 2370
Assuming lstThai1971 is a ListBox of sorts, I expect you want to :
lstThai1971.Items.Add(strArr(count))
You could also add the entire array using AddRange
lstThai1971.Items.AddRange(strArr)
Upvotes: 1