在VB.net中使按钮可单击一次

时间:2017-05-17 18:39:21

标签: vb.net

我正在尝试制作A按钮只能在Vb中单击一次 我在考虑这段代码

const arr = Array(10).fill(0);

const setNum = (pos, num, arr) => { // position, initial number, and array
  const a = arr.slice();
  a[pos] = num;
  for (let i = (pos - 1); i >= 0; i--) { a[i] = a[i+1]/2 }
  for (let i = (pos + 1); i < a.length; i++) { a[i] = a[i-1]/2 }
  return a;
}

console.log(setNum(5, 10, arr))

任何其他想法!     我也可以做一些事情,以便按钮在点击时发出声音吗?!

任何其他想法! 谢谢你

2 个答案:

答案 0 :(得分:4)

在点击活动中,您可以:

B64.Enabled = False

您还可以点击播放.WAV文件:

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

答案 1 :(得分:0)

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    Dim Element As Button = DirectCast(sender, Button)
    'Do Stuff....
    Element.Enabled = False
    Threading.Thread.Sleep(500)
    Element.Enabled = True
End Sub