Hi

Does anyone know how to place sound in a vb.net project? Thanks

Recommended Answers

All 3 Replies

Does anyone know how to place sound in a vb.net project?

If I take that literally, you're asking about embedding an audio resource? You do that from "Project" menu -> "<prjname> Properties" -> "Resources" tab, and there you select resource type (Audio) and the resource source (usually a file).

Or do you mean, how to play audio? The simplest form to play audio is My.Computer.Audio.Play() and that's an overloaded method, so the audio source can be almost anything (like a file, stream or a byte array). The method is however limited to wav-format.

More complex ways are setting a reference to Microsoft.DirectX (.NET) components or Windows Media Player (COM) components.

Hi

I meant to play an audio file, is it really that easy? Just one line of code?

I'll try it out. Thanks Teme64!

just import the namespace as
Imports System.Media

declare the object of SoundPlayer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.