'Make Buttons clickable once in VB.net

I'm Trying To make A button Only clickable once in Vb I was thinking of this code

 Sub B64_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B64.Click
    Dim BClick As Integer = 0
    If BClick = 0 Then
        BClick = 1
        'Other instructions
    End If

Any Other Ideas! Also Can I do something so that the button will make a sound when it is clicked ?!

Any Other Ideas! Thank u



Solution 1:[1]

In your click event you can do:

B64.Enabled = False

You can also play a .WAV file on click:

Dim player As New System.Media.SoundPlayer()
player.SoundLocation = path
player.Load()
player.Play()

Solution 2:[2]

Just Disable Button

Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
    Button1.Enabled = False
    'Do Stuff....
    '& Enable it if you want
    Button1.Enabled = True
End Sub

you can disable button or any control with this code by using Button1_Click(Button1, Nothing) or Button1_Click(Button2, Nothing)

Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
    Dim Element As Button = DirectCast(sender, Button)
    Element.Enabled = False
    'Do Stuff....
    'if you want delay use: Threading.Thread.Sleep(500)
    Element.Enabled = True
End Sub

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jason Bayldon
Solution 2