Results 1 to 10 of 10

Thread: [RESOLVED] Pressing enter instead of clicking...

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2006
    Posts
    51

    Resolved [RESOLVED] Pressing enter instead of clicking...

    This is fairly easy...
    If I click button1 with the mouse button, it does what it was supposed to do...
    But you know, like in MSN messenger, you don't have to click the "send" button, you can just press enter.

    So, how can I do this with my button?
    kakemot.com
    Submit your games or applications to kakemot.com!

  2. #2
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: Pressing enter instead of clicking...

    Quote Originally Posted by kakemot
    This is fairly easy...
    If I click button1 with the mouse button, it does what it was supposed to do...
    But you know, like in MSN messenger, you don't have to click the "send" button, you can just press enter.

    So, how can I do this with my button?
    Hi,

    Make that your button has the 'Focus' Enter and you'll see that the button does what he supposed to do.

    Wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2006
    Posts
    51

    Re: Pressing enter instead of clicking...

    Yea, ok, I know that...
    But then I will always have to "unfocus" the typing field.
    But whatever, I am close to solve this myself now.
    kakemot.com
    Submit your games or applications to kakemot.com!

  4. #4
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: Pressing enter instead of clicking...

    Quote Originally Posted by kakemot
    Yea, ok, I know that...
    But then I will always have to "unfocus" the typing field.
    But whatever, I am close to solve this myself now.
    Hi,

    I didn't know that you needed more.
    Here's a link about the Keypressevent, you might needed to solve your problem;

    http://msdn2.microsoft.com/en-us/lib...s.handled.aspx

    Wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  5. #5

    Thread Starter
    Member
    Join Date
    Aug 2006
    Posts
    51

    Re: [RESOLVED] Pressing enter instead of clicking...

    Ok, thanks!

    EDIT:
    Nothing works.
    Well, I will solve this somehow.

    Why do they make it so hard?
    It could just be a function like this:
    if keyboard_check_pressed(key_enter) = true then MsgBox("lol, you pressed enter")

    Last edited by kakemot; Oct 29th, 2006 at 08:52 AM.
    kakemot.com
    Submit your games or applications to kakemot.com!

  6. #6
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: [RESOLVED] Pressing enter instead of clicking...

    Try this:

    Code:
    If e.Keycode = Keys.Enter Then
    Button1.ProcessClick();
    End If
    It's something like that. Is that what you wanted?

  7. #7

    Thread Starter
    Member
    Join Date
    Aug 2006
    Posts
    51

    Re: [RESOLVED] Pressing enter instead of clicking...

    Yes, but it doesn't really work...
    It says that "Keycode" is not a member of KeyPressEventArgs.
    Shouldn't it be? :S

    EDIT:
    Well, Keychar is, but it doesn't work with "=".
    kakemot.com
    Submit your games or applications to kakemot.com!

  8. #8
    Lively Member
    Join Date
    Jun 2005
    Posts
    81

    Re: [RESOLVED] Pressing enter instead of clicking...

    Quote Originally Posted by kakemot
    This is fairly easy...
    If I click button1 with the mouse button, it does what it was supposed to do...
    But you know, like in MSN messenger, you don't have to click the "send" button, you can just press enter.

    So, how can I do this with my button?
    The Form this button is on has a Property call "AcceptButton"
    Set the Property to your button...Button1...
    This should do exactly what you need with no code.
    This just monitors the form for the "Enter" key then fires the "AcceptButtons" Click event.
    HTH.
    Good Luck!
    Matt
    It's all about Attitude!

  9. #9

    Thread Starter
    Member
    Join Date
    Aug 2006
    Posts
    51

    Re: [RESOLVED] Pressing enter instead of clicking...

    YAY!
    Thank you!

    ^^

    Yes, it worked.
    Last edited by kakemot; Oct 29th, 2006 at 10:26 AM.
    kakemot.com
    Submit your games or applications to kakemot.com!

  10. #10
    Lively Member
    Join Date
    Jun 2005
    Posts
    81

    Re: [RESOLVED] Pressing enter instead of clicking...

    Forgot to add...
    the form KeyPreview propoerty must be set to True.
    Matt
    It's all about Attitude!

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