How to make Enter on a TextBox act as TAB button

后端 未结 12 2640
迷失自我
迷失自我 2020-12-25 13:10

I\'ve several textboxes. I would like to make the Enter button act as Tab. So that when I will be in one textbox, pressing Enter will move me to the next one. Could you plea

12条回答
  •  借酒劲吻你
    2020-12-25 14:13

    It is important to note that if you will get an annoying "ding" or warning sound each time that the control is expecting an associated button control and e.Handled = true isn't always the answer to rid yourself of the noise/sound/ding.

    If the control (i.e. single-line textbox) is expecting an associated button to 'ENTER' your entry, then you must also deal with the 'missing' control.

    e.Handled = e.SuppressKeyPress = true;
    

    This may be helpful when getting rid of the 'ding' sound.

    For what it's worth- in my circumstance my users needed to use the "ENTER KEY" as we were transitioning from a terminal/green-screen application to a windows app and they were more used to "ENTER-ing" through fields rather than tabbing.

    All these methods worked but still kept the annoying sound until I added e.SuppressKeyPress.

提交回复
热议问题