CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Enter Key

  1. #1
    Join Date
    Aug 1999
    Posts
    74

    Enter Key

    I have a simple program. I have one text box and one label control, if I type in some number in the text box then click OK button it will give me some character. I want the user to be able to press ENTER key after type in the number in the text box. then it will trigger OK button. How am I gonna do that????


  2. #2
    Join Date
    May 1999
    Posts
    14

    Re: Enter Key

    In the KeyPress event for the text box write the following:

    If KeyAscii = 13 Then
    Call cmdCommand1_Click()
    End If

    Call the name of your Ok buttons Click event...
    KeyAscii 13 is the Enter key...


  3. #3
    Join Date
    Apr 1999
    Location
    Netherlands
    Posts
    181

    Re: Enter Key

    You can also set the default property of the command button to true, that way you don't have to do anything to let the command button catch the enter


    Crazy D @ Work :-)

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

Featured