我們常常要在TextBox1鍵入數字或資料後,直接按下鍵盤的 "Enter" 鍵,即能達到按下 Button1 的 "確定" 按鈕,直接能跳至下一步驟,而不需再移動滑鼠去點擊 "確定" 鍵。

 

 

程式碼如下

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
    If e.KeyChar = Chr(13) Then
    Button1_Click(Button1, New System.EventArgs())
    End If
 
    End Sub

文章標籤
全站熱搜
創作者介紹
創作者 his1666 的頭像
his1666

iOS 7, iphone, ipad,~iphonenews, ipadnews,平板news, 愛瘋news, 加上vb6和vb.net2010交流。

his1666 發表在 痞客邦 留言(0) 人氣(997)