Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Play Waves in VB.NET

, 16 Feb 2005
A simple Wave Player class.
The Microsoft Sound.wav
Public Class frm_Sound
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()

        'This call is required by the Windows Form Designer.

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
            End If
        End If
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.

    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.btnFile = New System.Windows.Forms.Button
        Me.btnEmbed = New System.Windows.Forms.Button
        Me.btnSystem = New System.Windows.Forms.Button
        Me.btnFile.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btnFile.Location = New System.Drawing.Point(16, 16)
        Me.btnFile.Name = "btnFile"
        Me.btnFile.Size = New System.Drawing.Size(264, 23)
        Me.btnFile.TabIndex = 0
        Me.btnFile.Text = "Wave From File"
        Me.btnEmbed.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btnEmbed.Location = New System.Drawing.Point(16, 96)
        Me.btnEmbed.Name = "btnEmbed"
        Me.btnEmbed.Size = New System.Drawing.Size(264, 23)
        Me.btnEmbed.TabIndex = 1
        Me.btnEmbed.Text = "Embedded Wave"
        Me.btnSystem.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btnSystem.Location = New System.Drawing.Point(16, 56)
        Me.btnSystem.Name = "btnSystem"
        Me.btnSystem.Size = New System.Drawing.Size(264, 23)
        Me.btnSystem.TabIndex = 2
        Me.btnSystem.Text = "System Wave"
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(304, 142)
        Me.Name = "frm_Sound"
        Me.Text = "Sound Test"

    End Sub

#End Region

    Friend WithEvents btnSystem As System.Windows.Forms.Button
    Friend WithEvents btnEmbed As System.Windows.Forms.Button
    Friend WithEvents btnFile As System.Windows.Forms.Button

    Private Sub btnFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFile.Click
        'File Located in executable dir, change it if you need
    End Sub

    Private Sub btnEmbed_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmbed.Click
        'Remeber to include the wyve in the project and then in the "build action"
        'properties set it as: "Embedded Resource"
        Sound.PlayWaveResource("The Microsoft Sound.wav")
    End Sub

    Private Sub btnSystem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSystem.Click

        'Here some ...


    End Sub
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Angelo Cresta
Chief Technology Officer
Switzerland Switzerland
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141216.1 | Last Updated 16 Feb 2005
Article Copyright 2005 by Angelo Cresta
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid