Listview/ Listbox Help
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts
Page 1 of 1
Ok Guys Now I need help on viewing the text file in either listbox or listview.
Either i view from a file, which i need to like separate them from the ","
or i can view from the website,
one line= one item
thanks in advance.
Either i view from a file, which i need to like separate them from the ","
or i can view from the website,
one line= one item
thanks in advance.
Code: Select all
Dim lines As String() = File.ReadAllLines("file.txt")
For i As Integer = 0 To lines.Length - 1
ListBox1.Items.Add(lines(i))
Next
thank you for the reply, but i was hoping to see it getting sorted out by the comma for eg
TXT FILE:
[Mary Said Hi][John Said Hi]
Listbox/Listview
[Mary Said Hi]
[John Said Hi]
TXT FILE:
[Mary Said Hi][John Said Hi]
Listbox/Listview
[Mary Said Hi]
[John Said Hi]
Try this:
item
item2,item3,item4
item5
The output will be:
item
item2
item3
item4
item5
Code: Select all
Where the input looks like this: Dim lines As String() = File.ReadAllLines("file.txt")
For i As Integer = 0 To lines.Length - 1
Dim subitems As String() = lines(i).Split(","c)
For i2 As Integer = 0 To subitems.Length - 1
ListBox1.Items.Add(subitems(i2))
Next
Next
item
item2,item3,item4
item5
The output will be:
item
item2
item3
item4
item5
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023