.NET

Reply
Mentor
SRSDS
Posts: 250
Registered: ‎04-15-2011
Message 1 of 3 (132 Views)

textbox Enter KeyEvent Argument not handled

132 Views, 2 Replies
05-02-2012 12:52 PM

I have a pallete with a textbox. The keydown event is triggered on every keydown event apart from  Enter.

    Private Sub txtBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtBox.KeyDown
        If e.KeyCode = Forms.Keys.Enter Then MsgBox("Enter Pressed")
    End Sub

 Has me baffled.

*Expert Elite*
Alfred.NESWADBA
Posts: 9,417
Registered: ‎06-29-2007
Message 2 of 3 (127 Views)

Re: textbox Enter KeyEvent Argument not handled

05-02-2012 01:23 PM in reply to: SRSDS

Hi,

 

the key <ENTER> has a special function as it is used to change the focus to the next control in tab-order. So the key is handled from another part and the event is then not fired to your eventhandler as "it is handled already".

 

I have searched a little and I think >>>that link (scroll down to the end)<<< comes close to what you are looking for.

 

The other opportunity would be to catch the LostFocus event it the fits to your workflow.

 

- alfred -

 

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Mentor
SRSDS
Posts: 250
Registered: ‎04-15-2011
Message 3 of 3 (105 Views)

Re: textbox Enter KeyEvent Argument not handled

05-03-2012 09:49 AM in reply to: Alfred.NESWADBA

Hi,

I tried the code from the page but it was causing some sort of problem in loading the pallete container.

 

I've found out that the KeyUp event can be used. The KeyDown and KeyPressed were two that I was trying previously.

 

But now that I think about it, the user has to make sure that they press enter so it's probably not what I want.

I think I should stick to doing it live with the TextChanged event.

 

Thanks again

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!