To develop a windows application for playing audio and video files using c#.net.
Design the form as above with an OpenFileDialog contol, one Button and 'Windows Media Player' contol (COM component).
Note that OpenFileDialog control appears below the form(not on the form), which is used in our application for browsing audio/video files.
Steps for adding 'Windows Media Player' control (COM component) into Toolbox:
By default, 'Windows Media Player' control is not provided in the toolbox, we have to add it into the toolbox if required.
Inorder to add 'Windows Media Player' control into toolbox
Right click on 'General' tab (or anyother tab) in toolbox ->select 'Choose Items...' ->select 'COM Components' tab ->select 'Windows Media Player' ->click on 'OK' button.
'Windows Media Player' control will appear in the toolbox.
Now, drag 'Windows Media Player' control on to the form and place a button on it with text as 'Browse..' as shown in the design.
public partial class Form1 : Form
btnBrowse_Click(object sender, EventArgs e)
openFileDialog1.Filter = "(mp3,wav,mp4,mov,wmv,mpg)|*.mp3;*.wav;*.mp4;*.mov;*.wmv;*.mpg|all
axWindowsMediaPlayer1.URL = openFileDialog1.FileName;