It just took me 20minutes to write my first VB.Net App (.Net FW 2)
There is no error handling or anything, but, it works!
Any tips in error handling? Or even how to do it...
Simply it strips Extended info and wma files from a winamp playlist.
VB Code:
Imports System.IO Public Class Form1 Private Sub CMDOpenFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CMDOpenFile.Click Dim FileName As String CDopen.Filter = "M3U Playlist|*.m3u|All Files|*.*" CDopen.ShowDialog() FileName = CDopen.FileName.ToString Dim s As String If FileName <> "" Then Dim sr As New StreamReader(FileName) While sr.Peek <> -1 s = sr.ReadLine.ToString List1.Items.Add(s) End While sr.Close() End If Label1.Text = "Line Count: " & List1.Items.Count() End Sub Private Sub CMDparse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CMDparse.Click Dim i As Long For i = List1.Items.Count() - 1 To 0 Step -1 Me.List1.SelectedIndex = i If List1.Text.StartsWith("#EXT") Or List1.Text.EndsWith(".wma") Then List1.Items.Remove(List1.Text) End If Label1.Text = "Line Count: " & List1.Items.Count() Next End Sub Private Sub CMDsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CMDsave.Click Dim i As Integer Dim FileName As String Dim sw As StreamWriter CDsave.Filter = "M3U Playlist|*.m3u|All Files|*.*" CDsave.ShowDialog() FileName = CDsave.FileName If FileName <> "" Then sw = New StreamWriter(FileName) For i = 0 To List1.Items.Count - 1 sw.WriteLine(List1.Items.Item(i)) Next sw.Close() End If End Sub End Class




Reply With Quote