【求助】文本框触发事件的问题
我想用在文本框按下回车键后触发一个事件,让按钮可以用,调试不出来,不知道下面的程序出了什么问题,请帮忙看看,谢谢。
新手,分很少,见谅~
Dim keyentered As String
Private Sub EntertheUserName(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If keyentered = Keys.Enter Then
Button1.Enabled = True
End If
End Sub
End Class
[解决办法]
Private Sub TextBox1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
Button1.Enabled = e.KeyCode = Keys.Enter
End Sub