0% found this document useful (0 votes)
10 views3 pages

VB Code

The document is a Visual Basic code for a media player application that allows users to browse, play, pause, stop, and manage a playlist of media files. It includes functionalities for adding, removing, clearing, shuffling, and repeating songs in the playlist. The application utilizes the AxWindowsMediaPlayer control for media playback and updates the display with the currently playing track information.

Uploaded by

osmankargbo167
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

VB Code

The document is a Visual Basic code for a media player application that allows users to browse, play, pause, stop, and manage a playlist of media files. It includes functionalities for adding, removing, clearing, shuffling, and repeating songs in the playlist. The application utilizes the AxWindowsMediaPlayer control for media playback and updates the display with the currently playing track information.

Uploaded by

osmankargbo167
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Imports AxWMPLib

Public Class Form1

Dim currentIndex As Integer = 0

' Browse media files


Private Sub btnBrowse_Click(sender As Object, e As EventArgs) Handles
[Link]
[Link] = "Media Files|*.mp3;*.mp4;*.wav;*.wmv"
[Link] = True

If [Link] = [Link] Then


For Each file As String In [Link]
[Link](file)
Next
End If
End Sub

' Play media


Private Sub btnPlay_Click(sender As Object, e As EventArgs) Handles
[Link]
If [Link] 0 Then
[Link] =
[Link](currentIndex).ToString()
[Link]()
[Link] = "Now Playing: " &
[Link]([Link])
End If
End Sub

' Pause media


Private Sub btnPause_Click(sender As Object, e As EventArgs) Handles
[Link]
[Link]()
End Sub

' Stop media


Private Sub btnStop_Click(sender As Object, e As EventArgs) Handles
[Link]
[Link]()
End Sub

' Next media


Private Sub btnNext_Click(sender As Object, e As EventArgs) Handles
[Link]
If currentIndex < [Link] - 1 Then
currentIndex += 1
[Link] =
[Link](currentIndex).ToString()
[Link]()
End If
End Sub

' Add selected to playlist


Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles
[Link]
If [Link] = [Link] Then
[Link]([Link])
End If
End Sub

' Remove selected file


Private Sub btnRemove_Click(sender As Object, e As EventArgs) Handles
[Link]
If [Link] = 0 Then
[Link]([Link])
End If
End Sub

' Clear playlist


Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles
[Link]
[Link]()
[Link]()
[Link] = "Now Playing:"
End Sub

' Shuffle playlist


Private Sub BtnShuffle_Click(sender As Object, e As EventArgs) Handles
[Link]
Dim rnd As New Random
Dim items = [Link](Of String)().OrderBy(Function()
[Link]()).ToList()
[Link]()

For Each item In items


[Link](item)
Next
End Sub

' Repeat current song


Private Sub BtnRepeat_Click(sender As Object, e As EventArgs) Handles
[Link]
[Link]("loop", True)
End Sub

Private Sub BtnPrevious_Click(sender As Object, e As EventArgs) Handles


[Link]
If [Link] 0 Then
currentIndex -= 1
If currentIndex 0 Then
currentIndex -= 1
Else
currentIndex = [Link] - 1 ' Loop to end
End If

[Link] =
[Link](currentIndex).ToString()
[Link]()
[Link] = "Now Playing:" &
[Link]([Link])
End If
End Sub
End Class

You might also like