Results 1 to 4 of 4

Thread: How to Trigger an Event using ENTER in the keyboard

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2008
    Location
    Philippines
    Posts
    70

    How to Trigger an Event using ENTER in the keyboard

    I just wat to trigger an event using the ENTER Button.. in VB 6.0 I'm just using the Keypress function and using the KeyAscii 13. How about in VB.Net

  2. #2
    Hyperactive Member mrmojorisin's Avatar
    Join Date
    Oct 2007
    Location
    London Town Vocation: Garden Cricket Genuis
    Posts
    439

    Re: How to Trigger an Event using ENTER in the keyboard

    What control are you using? Most controls in 2005 .net have a KeyDown event.
    Here is a really basic exmaple of pressing the enter key on a text box:
    vb Code:
    1. Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
    2.         If e.KeyCode = Keys.Enter Then
    3.             MsgBox("HELLO")
    4.         End If
    5.     End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2008
    Location
    Philippines
    Posts
    70

    Re: How to Trigger an Event using ENTER in the keyboard

    Thanks.... I'll try it..

  4. #4
    Hyperactive Member mrmojorisin's Avatar
    Join Date
    Oct 2007
    Location
    London Town Vocation: Garden Cricket Genuis
    Posts
    439

    Re: How to Trigger an Event using ENTER in the keyboard

    Ok, don't forget to mark thread as resolved and rate posts when finished!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width