ramone Posted November 3, 2005 Posted November 3, 2005 hello, i want to call the click event handler of a button when the user hits the enter key after typing some text in a textbox, but the keypress event of the text box only works with characters keys, what can i do? thank you Quote
techmanbd Posted November 3, 2005 Posted November 3, 2005 Private Sub txt_peypress(ByVal system As System.Object, ByVal e As KeyPressEventArgs) Handles TextBox1.KeyPress If e.KeyChar = Chr(Keys.Enter) Then ' whatever needs to be done here End If End Sub Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
Leaders snarfblam Posted November 3, 2005 Leaders Posted November 3, 2005 You probably want to set e.handled to true to prevent extra carrige returns in multiline textboxes or the error sound in singleline textboxes. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.