Bitch
Steganography Expert
Divine
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
400 XP
In this tutorial, I will teach you how to create a program that will open, play, and stop a windows media player application in C#.
So, now let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio 2010: Go to File, click New Project, and choose Windows Application.
2. Add three buttons in your Form such as Choose File, Play, and Stop button; add also one textbox for the filename.
Then right click anywhere on the toolbox and click "Choose Items".
Right click the project to add reference.
And then on the COM tab, choose Windows Media Player.
Then click the windows media player in the toolbox and put it inside the form.
3. Now, have this code below inside the button1 as your browsing of files button.
In the Play button, have also this code:
And in the Stop button, copy this code:
Output:
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
If you have some queries, feel free to contact the number or e-mail below.
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware
So, now let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio 2010: Go to File, click New Project, and choose Windows Application.
2. Add three buttons in your Form such as Choose File, Play, and Stop button; add also one textbox for the filename.
Then right click anywhere on the toolbox and click "Choose Items".

Right click the project to add reference.

And then on the COM tab, choose Windows Media Player.

Then click the windows media player in the toolbox and put it inside the form.

3. Now, have this code below inside the button1 as your browsing of files button.
- private
void
button1_Click(
object
sender, EventArgs e)
- {
- //get the filename of the choosen file
- OpenFileDialog opf =
new
OpenFileDialog(
)
;
- if
(
opf.
ShowDialog
(
)
==
DialogResult.
OK
)
- {
- //display the filename on the textbox
- textBox1.
Text
=
opf.
FileName
;
- }
- }
In the Play button, have also this code:
- private
void
button2_Click(
object
sender, EventArgs e)
- {
- //get the filename and will be equal to the URL of the media player
- axWindowsMediaPlayer1.
URL
=
textBox1.
Text
;
- //play the file
- axWindowsMediaPlayer1.
Ctlcontrols
.
play
(
)
;
- }
And in the Stop button, copy this code:
- private
void
button3_Click(
object
sender, EventArgs e)
- {
- //stop the file
- axWindowsMediaPlayer1.
Ctlcontrols
.
stop
(
)
;
- }
Output:

For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
If you have some queries, feel free to contact the number or e-mail below.
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware