Visual Basic 2010 - Button Sound / Music Play
Visual Basic 2010 - Button Sound / Music Play
5 of 5
Visual Basic 2010 - Button Sound
 |
Visual Basic 2010 - Play sound on buttons |
The code is simply goes like this
You can copy and paste in your (Click_Event) or whatever it is you wish (MouseClick - MouseHover - MouseLeave) :
- Dim MySound As New System.Media.SoundPlayer()
-
- MySound.SoundLocation = "path to the .Wav file"
- MySound.Load()
- MySound.Play()
' OR you can use this :
- Sub PlaySystemSound()
- My.Computer.Audio.PlaySystemSound(
System.Media.SystemSounds.Asterisk)
- End Sub
Background playing
It lets the
application execute other code while the sound plays. The
My.Computer.Audio.Play method allows the
application to play only one background sound at a time; when the application plays a new background sound, it stops playing the previous background sound. You can also play a sound and wait for it to complete.
For
Visual Basic 2010 and in general, when an application plays a looping sound, it should eventually stop the sound. For more information, see How to: Stop Playing Sounds in the Background in
Visual Basic 2010.
Example
The My.Computer.Audio.Play method plays a sound. When AudioPlayMode.WaitToComplete is specified, My.Computer.Audio.Play waits until the sound completes before calling code continues.
Check that the file name references a .wav sound file on your system.
- Sub PlayBackgroundSoundFile()
My.Computer.Audio.Play("C:\Waterfall.wav",
AudioPlayMode.WaitToComplete)
End Sub
The My.Computer.Audio.Play method plays a sound. When AudioPlayMode.WaitToComplete is specified, My.Computer.Audio.Play waits until the sound completes before calling code continues.
Check that the application resources include a .wav sound file named Waterfall.
- Sub PlayBackgroundSoundResource()
My.Computer.Audio.Play(My.Resources.Waterfall,
AudioPlayMode.WaitToComplete)
End Sub
♥ Here are some online Visual Basic lessons and courses :
Popular posts from this blog
Your next great app. Your way. From interactive Desktop applications, to immerse Web and Mobile solutions, tools to meet your needs today and ensure your continued success tomorrow. DevExpressis a very powerful tool for
Microsoft Visual Studio 2010 and any Visual Studio starting VS2005 until VS2012. From the above 4Shared.com Widget you can download DevExpress 12.2.4 freely, the uploaded files contain the registration for free Dll
leaked [dxv2_regaddin.12.2.4]. The download should be merged in one folder and the 3 parts of Dxperience should be all downloaded and extracted [Merged] in the same folder.
After downloading
♦ Extract the 3 files :
♠ Devexpress-12.2.4-by-evry1.net.part1.rar ♠ DevExpress-12.2.4-by-evry1.net.part2.rar♠ DevExpress-12.2.4-by-evry1.net.part3.rar
into one folder, you will find 2 files after extraction [DevExpress 12.2.4 and dxv2_regaddin.12.2.4].
♦ Double-click the Devexpress 12.2.4 exe file and install Dxperience 12.2.4, you may also choose [Trial Version] fo…
The following control could not be licensed: TxTextControl.TextControl
How to compile a specific license (*.licx) file to your
Visual Basic 2010 project for example the [Tx TxtControl] Object. Tx TxtControl is an evaluation product and can be downloaded from
here, unless you register the product with a standard license, it will not work properly with
Visual Basic 2010.
Tx TxtControl is a Visual Basic .Net powerful tool that enable you to create a Word Processing Integration form to enable the user to take notes and save it and retrieve it. With Tx TxtControl you can do the following : Integrate comprehensive word processing into your Windows applicationsLoad, edit and save Microsoft Word formats (DOCX, DOC, RTF etc.)Build powerful reporting and mail merge applicationsLoad, edit and create Adobe PDF documentsCompletely royalty-free
The problem is that the Eval. Version pops up a message in the IDE and the Run-Time and generate an error message :
The following control could not be license…
Visual Basic Online Course - Command Prompt
Read / Write Windows Command Prompt from VB 2010
Command Prompt
A command prompt is an entry point for typing computer commands in the Command Prompt window. By typing commands at the command prompt, you can perform tasks on your computer without using the Windows graphical interface.
Command Prompt Commands(A)
ADDUSERS Add or list users to/from a CSV file
ARP Address Resolution Protocol
~ ASSOC Change file extension associations
ASSOCIAT One step file association
AT Schedule a command to run at a later time
ATTRIB Change file attributes
(B)
BOOTCFG Edit Windows boot settings
BROWSTAT Get domain, browser and PDC info
(C)
CACLS Change file permissions
~ CALL Call one batch program from another
~ CD Change Directory - move to a specific Folder
CHANGE Change Terminal Server Session properties
CHKDSK Check Disk - check and repair disk problems
CHKNTFS Check the NTFS file system
CHOICE Accept keyboard input to a batch file
CIPHER Encrypt or Decr…
The Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine
Visual Basic 2010 Error Message :InvalidOperationException was unhandled" The Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine" ?
This error message means that the machine [Computer, Laptop] that you are trying to run your application on, doesn't have
MS-Access 2007 installed, or not installed properly. Some developers just pack their applications and send it to the client :
- relying on - that the client have MS-Office 2007/2010 installed already and won't never crash or updated to 2010,
- or they just did not include the proper component along with their package,
- or even worse they may not know what exactly should they do to make it work on the client's machine.
╚╣ To get this error message to go away, you need to include this file in your package : 2007 Microsoft Office System Update: Redistributable Primary Interop Assemblies
Some think that Office 2007 s…
VB .NET DataGridView Add Edit Delete
Manipulate DataGridView from Visual Basic 2010 with SQL Server
Note : if you dunno how to work SqlServer With VB.Net : You need to see this then this
Logic
Using DataGridView Control In VB.Net to Add New - Edit - Delete from/to Sql Server Database or MS-Access or any other Database type. You will find in the end of the lessons the project to download along with source code .
Design
1) Create a new Visual Basic project (Windows Application) name it as (MyDg1) and save it to your hard drive.
2) Place a DataGridView Control on the Form1.
3) Create Sql Server Database file, name it (MyDB)
4) Create Table, name it (Kinds) with just one record, name it (Kinds)
5) Rename the DataGridView Control's name From (DataGridView1) to (DG1)
6) Save/Build the project .
7) Now you have : A project such as this one in the 3 photos (from inside VB.Net and from Outside)
- What do we want to do ?!!!!
we want to update the database (MyDB) Table (Kinds) Record (Kind)…