[Guide] Visual Basic 2008 - How to make a Music Maker -
05-20-2008
Lets Go
This Program will do the following:
When up press Z it makes a Error Sound, when u press X it makes Asterisk Sound, Spacebar makes a Beep and C makes a Exclamation Sound
Design :
1) Open Visual Basic 2008
2) set a background if u like
3) Make 4 labels saying
4) Z = Error Sound
5) X = Exclamation Sound
6) C = Asterisk Sound
7) Spacebar = Beep Sound
8) The Icon
i suggest u use this icon : [Only registered and activated users can see links. ]
Coding :
1) Double Click the Form1 so it says the code for Form1_Load
2) But we wont need the Form1_Load, So..
3) Under the menu in the top, and Above the Code, u see a lightning
4) The Lightning says "(Form1 Events)" and at its side there is "Load"
5) Click on Load, and choose KeyDown instead of Load.
6) Now Delete the Form1_Load, And were ready for the code !
7) Add this code :
Code:
If e.KeyCode = Keys.Z Then
Media.SystemSounds.Hand.Play()
It Does so when u press "Z" There comes a Error Sound
8) This is For X to make Exclamation Sound :
Code:
ElseIf e.KeyCode = Keys.X Then
Media.SystemSounds.Exclamation.Play()
9) This is for C to make Asterisk Sound
Code:
ElseIf e.KeyCode = Keys.C Then
Media.SystemSounds.Asterisk.Play()
10) Now the Spacebar have to say "Beep" so we add this code :
Code:
ElseIf e.KeyCode = Keys.Space Then
Media.SystemSounds.Beep.Play()
11) Full Code :
Code:
Public Class Form1
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Z Then
Media.SystemSounds.Hand.Play()
ElseIf e.KeyCode = Keys.X Then
Media.SystemSounds.Exclamation.Play()
ElseIf e.KeyCode = Keys.C Then
Media.SystemSounds.Asterisk.Play()
ElseIf e.KeyCode = Keys.Space Then
Media.SystemSounds.Beep.Play()
End If
End Sub
End Class
12) And Then were done, now debug it and build it, then save it. if u see any errors ur willing to contact me on [Only registered and activated users can see links. ] or PM Me
Enjoy !