Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要将此语言(用 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。
txt2
有人能帮我吗?谢谢。
尝试这个:
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