注册 登录
编程论坛 VB.NET论坛

vb.net 实现 文本框回车事件怎么写?

angela880410 发布于 2012-06-27 11:25, 1467 次点击
实现  文本框回车事件怎么写?


这个是我写的,但是运行的时候回车没有反应?哪里错了?
Private Sub TB_CarNum_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TB_CarNum.KeyPress
        If (e.KeyChar.ToString = Keys.Enter.ToString) Then
            test.Text = "待完成。。"

        End If
1 回复
#2
wumingchenxi2012-07-16 06:55
e.KeyChar.ToString="\r"
Keys.Enter.ToString="Return"
他们当然不相等

试一下
If (e.KeyChar=13 ) Then
    test.Text = "待完成。。"
End If
1