VB.Net - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

VB.Net Media Player

VB.Net Media Player

shape Description

Developing an application using VB.Net is always an interesting task why because everything is drag and drop so it is an excellent feature of Dot.Net.Media player is used to read the selected item as video stream or audio stream, based this feature many applications were developed using different technologies like windows media player was developed the Microsoft ,Following are the available media players in the market.

shape Example

Following is an example to design a windows media player.First import the windows media player to toolbox from developer can drag that, first go to openfiledialogue then give right click and select choose items., following is the strategy to select the player . Now drag and drop the media player icon and take four buttons and rename their names as follows. Following is the code to those buttons mean that when click on those required action will be performed. [vbnet]Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If (OpenFileDialog1.ShowDialog = DialogResult.OK) Then AxWindowsMediaPlayer1.URL = OpenFileDialog1.FileName End If End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click AxWindowsMediaPlayer1.Ctlcontrols.play() End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click AxWindowsMediaPlayer1.Ctlcontrols.stop() End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click AxWindowsMediaPlayer1.Ctlcontrols.pause() End Sub End Class [/vbnet] To compile the application click on start button then form will be displayed where user need to load the audio file or video file then it works as follows.When click stop button media will be stopped.

shape Programming Tips

  • AxWindowsMediaPlayer1 is the name of the media player.
  • The Windows media player was developed by Microsoft.
  • Ctrcontroll is the property of AxWindowsMediaPlayer1