Friday, November 19, 2010

How can I place sound on a form in VB.NET 2003? I also need to have that sound changed during run time?

I'm new to this, so please be detailed.How can I place sound on a form in VB.NET 2003? I also need to have that sound changed during run time?
There is no need to add anything extra to the form.

The .NET framework has everything you need to play sound.





Use the '; My.Computer.Audio '; name space



Use it like this



My.Computer.Audio.Play(';c:\myFileLocat鈥?br>


if you want to change the file string that is in a textbox named textbox1



dim filename as String

filename=textbox1.text

My.Computer.Audio.Stop()

My.Computer.Audio.Play(filename)How can I place sound on a form in VB.NET 2003? I also need to have that sound changed during run time?
You need to add the Media player control, located in the COM Components panel.



Then you will need to add code to handle your media files.

No comments:

Post a Comment