window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MR3GEP154W'); INFOPACKED
Showing posts with label free stuffs. Show all posts
Showing posts with label free stuffs. Show all posts

Monday, October 26, 2015

Use this Free Code to build your Music/video player

Public Class Form1

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        OpenFileDialog1.ShowDialog()
        AxWindowsMediaPlayer1.URL = OpenFileDialog1.FileName
        TextBox1.Text = System.IO.Path.GetFileName(
ListBox2.SelectedItem)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        AxWindowsMediaPlayer1.Ctlcontrols.play()
        TextBox1.Text = ListBox2.SelectedItem
        AxWindowsMediaPlayer1.URL = ListBox1.SelectedItem
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        AxWindowsMediaPlayer1.Ctlcontrols.stop()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Try
            ListBox1.SelectedIndex += -1
            ListBox2.SelectedIndex += -1
            AxWindowsMediaPlayer1.URL = ListBox1.SelectedItem
            TextBox1.Text = System.IO.Path.GetFileName(ListBox1.SelectedItem)
        Catch ex As Exception
            MsgBox("no track")
        End Try
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Try
            ListBox1.SelectedIndex += +1
            ListBox2.SelectedIndex += +1
            AxWindowsMediaPlayer1.URL = ListBox1.SelectedItem
            TextBox1.Text = System.IO.Path.GetFileName(ListBox1.SelectedItem)
        Catch ex As Exception
            MsgBox("no track")
        End Try
    End Sub

    Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
        For Each track In OpenFileDialog1.FileNames
            ListBox2.Items.Add(System.IO.Path.GetFileName(track))
        Next
        For Each track In OpenFileDialog1.FileNames
            ListBox1.Items.Add(track)
        Next
        ListBox2.SelectedIndex = 0
        ListBox1.SelectedIndex = 0

        TextBox1.Text = System.IO.Path.GetFileName(ListBox1.SelectedItem)

    End Sub
    Public Sub player_PlayStateChanged(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer1.PlayStateChange

       
        If AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsUndefined Then



            ListBox1.SelectedIndex = +1

            AxWindowsMediaPlayer1.Ctlcontrols.play()

        End If

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If (AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped) Then

            If (ListBox1.SelectedIndex < ListBox1.Items.Count - 1) Then

                ListBox1.SelectedIndex = ListBox1.SelectedIndex + 1

                AxWindowsMediaPlayer1.URL = ListBox1.SelectedItem

                AxWindowsMediaPlayer1.Ctlcontrols.play()
            End If

        End If

    End Sub
End Class