Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Video Player
Author:
SANJAY KUMAR MEHTA
E-mail:
Click to e-mail author
Submitted:
5/23/2012
Version:
VB 2008
Compatibility:
VB 2008, VB 2010
Category:
Multimedia
Views:
9483
This is a media player.
Declarations:
'none
Code:
Public Class Form1 Private Sub wmp_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles wmp.Enter End Sub Private Sub Lstsongs_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Lstsongs.SelectedIndexChanged If Lstsongs.SelectedItem.ToString <> "" Then wmp.URL = Lstsongs.SelectedItem.ToString End If End Sub Private Sub BtnPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) If wmp.URL <> "" Then wmp.Ctlcontrols.play() Else If Lstsongs.SelectedItem.ToString <> "" Then wmp.URL = Lstsongs.SelectedItem.ToString wmp.Ctlcontrols.play() End If End If End Sub Private Sub BtnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAdd.Click FolderBrowserDialog1.ShowDialog() Dim Fls() As String Fls = IO.Directory.GetFileSystemEntries(FolderBrowserDialog1.SelectedPath) Dim str As String Lstsongs.Items.Clear() For Each str In Fls If Microsoft.VisualBasic.Right(str, 3) = "avi" Then Lstsongs.Items.Add(str) End If Next For Each str In Fls If Microsoft.VisualBasic.Right(str, 3) = "mpg" Then Lstsongs.Items.Add(str) End If Next For Each str In Fls If Microsoft.VisualBasic.Right(str, 3) = "3gp" Then Lstsongs.Items.Add(str) End If Next For Each str In Fls If Microsoft.VisualBasic.Right(str, 3) = "mp4" Then Lstsongs.Items.Add(str) End If Next For Each str In Fls If Microsoft.VisualBasic.Right(str, 3) = "mkv" Then Lstsongs.Items.Add(str) End If Next For Each str In Fls If Microsoft.VisualBasic.Right(str, 3) = "dat" Then Lstsongs.Items.Add(str) End If Next For Each str In Fls If Microsoft.VisualBasic.Right(str, 4) = "divx" Then Lstsongs.Items.Add(str) End If Next For Each str In Fls If Microsoft.VisualBasic.Right(str, 3) = "wmv" Then Lstsongs.Items.Add(str) End If Next For Each str In Fls If Microsoft.VisualBasic.Right(str, 3) = "flv" Then Lstsongs.Items.Add(str) End If Next For Each str In Fls If Microsoft.VisualBasic.Right(str, 4) = "mpeg" Then Lstsongs.Items.Add(str) End If Next For Each str In Fls If Microsoft.VisualBasic.Right(str, 3) = "mp3" Then Lstsongs.Items.Add(str) End If Next End Sub Private Sub Btnstop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnstop.Click wmp.Ctlcontrols.stop() End Sub Private Sub BtnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNext.Click If Lstsongs.SelectedIndex >= Lstsongs.Items.Count - 1 Then Lstsongs.SelectedIndex = 0 Else Lstsongs.SelectedIndex = Lstsongs.SelectedIndex + 1 End If If Lstsongs.SelectedItem.ToString <> "" Then wmp.URL = Lstsongs.SelectedItem.ToString End If End Sub Private Sub BtnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPrevious.Click If Lstsongs.SelectedIndex <= 0 Then Lstsongs.SelectedIndex = Lstsongs.Items.Count - 1 Else Lstsongs.SelectedIndex = Lstsongs.SelectedIndex - 1 End If If Lstsongs.SelectedItem.ToString <> "" Then wmp.URL = Lstsongs.SelectedItem.ToString End If End Sub Private Sub BtnPause_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) wmp.Ctlcontrols.pause() End Sub End Class
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement