0

我需要将此语言(用 VB6 编写)转换为 VB.NET:

Private Sub txt1_KeyPress(KeyAscii as Integer)
   If KeyAscii=13 Then
       XXX=CStr(txt1.Text)
       txt2.SetFocus
   End If
End Sub

我只是希望通过Enter按键 (KeyAscii=13) txt1 将焦点设置为下一个文本框txt2

有人能帮我吗?谢谢。

4

1 回答 1

1

尝试这个:

Private Sub Txt1_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles Txt1.KeyPress
    If e.KeyChar.ToString = ChrW(Keys.Enter) Then
        Txt2.Focus()
        e.Handled = True
    End If
End Sub
于 2012-07-14T11:52:27.427 回答