[Help] Read & write text file like:NAME1, LINK[Solved]

Posts 1–7 of 7 · Page 1 of 1
[Help] Read & write text file like:NAME1, LINK[Solved]
Hello,

I'm making a radioplayer, but i need to write and read file like this:
RADIO1, LINKTOSTREAM
RADIO2, LINKTOSTREAM
etc..

Now i'm trying to get that RADIO1, RADIO2.. intro a listbox, and the radio1link must be loaded if i click radio1 (same for other radio's)
Do you guys know some code or a google search tag? I already found reading files line by line but i'm unable to make the listbox load the link if i click on the item.
wut?
explain betta
Example:

Save each radiostream in one line.

Radio1=Link
Radio2=Link
Radio3=Link

[highlight="VBnet"]Dim line as string

Using sRead as new io.streamreader("filepath")
while not sread.endofstream
line = sread.readline
if line.trim <> "" then
dim splitted() as string = split(line, "=")
listbox1.items.add(splitted(0))
listbox1.items(listbox1.items.count - 1).subitems.add(splitted(1))
end if
end while
end using[/highlight]
Quote Originally Posted by Blubb1337 View Post
Example:

Save each radiostream in one line.

Radio1=Link
Radio2=Link
Radio3=Link

[highlight="VBnet"]Dim line as string

Using sRead as new io.streamreader("filepath")
while not sread.endofstream
line = sread.readline
if line.trim <> "" then
dim splitted() as string = split(line, "=")
listbox1.items.add(splitted(0))
listbox1.items(listbox1.items.count - 1).subitems.add(splitted(1))
end if
end while
end using[/highlight]
A listbox doesn't have subitems lolwut?
Quote Originally Posted by Blubb1337 View Post
Example:

Save each radiostream in one line.

Radio1=Link
Radio2=Link
Radio3=Link

[highlight="VBnet"]Dim line as string

Using sRead as new io.streamreader("filepath")
while not sread.endofstream
line = sread.readline
if line.trim <> "" then
dim splitted() as string = split(line, "=")
listbox1.items.add(splitted(0))
listbox1.items(listbox1.items.count - 1).subitems.add(splitted(1))
end if
end while
end using[/highlight]
I'm using DotNetBar (itempanel)
so it will be this:
Code:
Dim line As String

        Using sRead As New IO.StreamReader("filepath")
            While Not sRead.EndOfStream
                line = sRead.ReadLine
                If line.Trim <> "" Then
                    Dim splitted() As String = Split(line, "=")
                    ItemPanel1.Items.Add(splitted(0))
                    ItemPanel1.Items(ItemPanel1.Items.Count - 1).SubItems.Add(splitted(1))
                End If
            End While
        End Using
and it gives this error:
Code:
Error	2	Value of type 'String' cannot be converted to 'DevComponents.DotNetBar.BaseItem'.	C:\Users\...\Documents\Visual Studio 2010\Projects\Radio Player1\Radio Player1\Form1.vb...
on:'splitted(0)' and 'splitted(1)' is there a way to use this with itempanel or do i have to use a listbox?

EDIT:For testing i added a listbox and used your code and for some reason this line:'ListBox1.Items(ListBox1.Items.Count - 1).SubItems.Add(splitted(1))' get highlighted in yellow without any error or warning showing.

NVM all above this.
When i click an item i want the program to do this:
AxWindowsMediaPlayer1.URL = LINK
Quote Originally Posted by shotyoudie View Post
I'm using DotNetBar (itempanel)
so it will be this:
Code:
Dim line As String

        Using sRead As New IO.StreamReader("filepath")
            While Not sRead.EndOfStream
                line = sRead.ReadLine
                If line.Trim <> "" Then
                    Dim splitted() As String = Split(line, "=")
                    ItemPanel1.Items.Add(splitted(0))
                    ItemPanel1.Items(ItemPanel1.Items.Count - 1).SubItems.Add(splitted(1))
                End If
            End While
        End Using
and it gives this error:
Code:
Error	2	Value of type 'String' cannot be converted to 'DevComponents.DotNetBar.BaseItem'.	C:\Users\...\Documents\Visual Studio 2010\Projects\Radio Player1\Radio Player1\Form1.vb...
on:'splitted(0)' and 'splitted(1)' is there a way to use this with itempanel or do i have to use a listbox?

EDIT:For testing i added a listbox and used your code and for some reason this line:'ListBox1.Items(ListBox1.Items.Count - 1).SubItems.Add(splitted(1))' get highlighted in yellow without any error or warning showing.

NVM all above this.
When i click an item i want the program to do this:
AxWindowsMediaPlayer1.URL = LINK
Mediaplayer.url = listview1.selecteditems(0).subitems(0).text

...or similiar...
Listview...-.-
Posts 1–7 of 7 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us