例:
Dim z1 As Double
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Chr(13) Then
e.Handled = True
z1 = Val(TextBox1.Text) 'z1為輸入值
TextBox2.Focus() '游標跳至TextBox2.Text
End If
End Sub
注意:1.要用KeyPress否則程式不能執行 2.按 [Enter] 鍵 表示輸入結束
沒有留言:
張貼留言