我一直试图在visual basic中模拟一个自由点而且它已经没事了,我已经从1-9获得了按钮并设置了一个清晰的键但是我删除了代码在这里缩短它。我想知道是否有任何替代方法可以在使用OK关闭MsgBox时更改代码段。我想特别改变的部分是:
如果Label1.Text ="请稍候.." 然后 Label1.Text ="继续输入您的PIN码。" 结束如果
在下面的代码中,我尝试使用:Threading.Thread.Sleep(5000)但它所做的只是导致整个程序冻结直到它完成然后继续做整个脚本。我真正想要它做的是将Label1中的文本更改为我已经尝试过的内容。这可能非常容易,但我还是新手,所以任何帮助都会非常感激!
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim buttonArray = {btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btn0, btnClear}
For Each button In buttonArray
button.Enabled = False
Next
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim buttonArray = {btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btn0, btnClear}
barProgress.Increment(5)
If barProgress.Value = 100 Then
For Each Button In buttonArray
Button.Enabled = True
Next
Timer1.Stop()
MsgBox("Please insert your pin into our secure system.")
End If
End Sub
Private Sub btnInsertCard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsertCard.Click
Timer1.Start()
Label1.Text = "Please wait.."
If btnInsertCard.Text = "Insert Your Card" Then
btnInsertCard.Text = "Please wait.."
End If
If Label1.Text = "Please wait.." Then
Label1.Text = "Proceed to enter your pin."
End If
End Sub
End Class