{help}mp3 player
hey, i got every thing working need help making it so it will save the songs i add
[php]if io.file.exists(io.path.combine(application.startup path, "Songs.txt"))
using writer as new io.streamwriter(io.path.combine(application.startu ppath, "Songs.txt"))
for each item as string in listbox1.items
writer.write(item & vbnewline)
next
end using
end if[/php]
[php]if io.file.exists(io.path.combine(application.startup path, "Songs.txt"))
using reader as new io.streamreader(io.path.combine(application.startu ppath, "Songs.txt"))
while not reader.endofstream
listbox1.items.add(reader.readline)
end while
end using
end if[/php]
using writer as new io.streamwriter(io.path.combine(application.startu ppath, "Songs.txt"))
for each item as string in listbox1.items
writer.write(item & vbnewline)
next
end using
end if[/php]
[php]if io.file.exists(io.path.combine(application.startup path, "Songs.txt"))
using reader as new io.streamreader(io.path.combine(application.startu ppath, "Songs.txt"))
while not reader.endofstream
listbox1.items.add(reader.readline)
end while
end using
end if[/php]
Neater version (
):
[php]
Dim SavedLoc As String = IO.Path.Combine(Application.StartupPath, "Songs.txt")
'put this in globals
[/php]
saving:
[php]
Using sWrite As New StreamWriter(SavedLoc, False)
For Each item As String in ListBox1,Items
sWrite.WriteLine(item)
Next
End Using
[/php]
Retrieving is the same essentially but add in "SavedLoc" instead.
@Alcohol, I think you're a tiny bit late buddy
):[php]
Dim SavedLoc As String = IO.Path.Combine(Application.StartupPath, "Songs.txt")
'put this in globals
[/php]
saving:
[php]
Using sWrite As New StreamWriter(SavedLoc, False)
For Each item As String in ListBox1,Items
sWrite.WriteLine(item)
Next
End Using
[/php]
Retrieving is the same essentially but add in "SavedLoc" instead.
@Alcohol, I think you're a tiny bit late buddy

i dont understand that all i need to do is save the textbox
I thought it is a listbox -.-
Use my.Settings if it's just a textbox...we have some tutorial on here...
Use my.Settings if it's just a textbox...we have some tutorial on here...
yea its a list box i made it so i can add songs then play them but i want to close mp3 player then open it and every things still there
I just gave you a copy friendly code for it x.x
You can also store them in mysettings using a string() and split it afterwards, but I don't think you can do this yet...
You can also store them in mysettings using a string() and split it afterwards, but I don't think you can do this yet...
im not smart hard for me to understand things
Then programming might not be the right hobby for you.
idc its fun for me
[php]ListBox1.Items.Add(openfd.Filename)[/php]
[php]AxWindowsMediaPlayer1.URL = ListBox1.SelectedItem[/php]
here simple codes
[php]AxWindowsMediaPlayer1.URL = ListBox1.SelectedItem[/php]
here simple codes
Look, you need more help. Add me on msn. Stevensaks@hotmail.com
That's if you need help ofcourse.
And to add items to listbox, you will need a openfiledialog.
And you will need basic understanding of VB to make a mediaplayer. Have fun.
That's if you need help ofcourse.
And to add items to listbox, you will need a openfiledialog.
And you will need basic understanding of VB to make a mediaplayer. Have fun.
This thread is closed for replies.

