Need to host a subversion repository? Try our hosted development tools.

VB.NET

Moderators: seancampbell
Number of threads: 3618
Number of posts: 9200

This Forum Only
Post New Thread

Report
Newbie Question: How to put sound effect on a buttons? Posted by Fru53tedPro9mr on 10 Nov 2009 at 4:07 AM
I want to learn more... Please help me..

Im using VB 2008 Express Edition right now
but VB.Net is also acceptable. please help me....

Thanks a lot.


Report
Re: Newbie Question: How to put sound effect on a buttons? Posted by Fru53tedPro9mr on 10 Nov 2009 at 4:09 AM
forgive my English^^
Report
Re: Newbie Question: How to put sound effect on a buttons? Posted by marius40 on 10 Nov 2009 at 2:15 PM
Try this, it makes a Alien sound when the mouse enters the Button1... you can attach this to any mouse event..

Public Class Form1
    'The following code creates a Point array to play a simple melody:
    Dim soundsAlien As Point() = {New Point(932, 500), New Point(1047, 500), New Point(831, 500), New Point(415, 500), New Point(622, 900)}
    Private Sub Button1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseEnter
        PlayTones(soundsAlien)
    End Sub
    Public Sub PlayTones(ByVal toneArray() As Point)
        ' ----- Play a set of tones, one after another.
        Dim frequency As Integer
        Dim duration As Integer
        For Each tone As Point In toneArray
            frequency = tone.X
            duration = tone.Y
            Console.Beep(frequency, duration)
        Next tone
    End Sub
End Class




 
Popular resources and forums for programmers on Programmersheaven.com
Assembly, Basic, C, C#, C++, Delphi, Java, JavaScript, Pascal, Perl, PHP, Python, Ruby, Visual Basic
© Copyright 2009 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin. Read the latest words from the publisher here.
Be the first to sign up for Lars Hagelin’s In-depth Outsourcing Newsletter here.
bootstrapLabs Logo A bootstrapLabs project.