Results 1 to 7 of 7
  1. #1
    shotyoudie's Avatar
    Join Date
    May 2009
    Gender
    female
    Posts
    119
    Reputation
    10
    Thanks
    6
    My Mood
    Angelic

    [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.

  2. #2
    ♪~ ᕕ(ᐛ)ᕗ's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Uterus
    Posts
    9,119
    Reputation
    1096
    Thanks
    1,970
    My Mood
    Doh
    wut?
    explain betta

  3. #3
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    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]
    Last edited by NextGen1; 02-05-2011 at 08:53 AM.



  4. The Following User Says Thank You to Blubb1337 For This Useful Post:

    NextGen1 (02-05-2011)

  5. #4
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    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 Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  6. #5
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    Listview...-.-



  7. #6
    shotyoudie's Avatar
    Join Date
    May 2009
    Gender
    female
    Posts
    119
    Reputation
    10
    Thanks
    6
    My Mood
    Angelic
    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
    Last edited by shotyoudie; 02-05-2011 at 11:54 AM.

  8. #7
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    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...