Alex Rivera | Logout

disabling default button or enter key in asp.net c#

Asked 2009-12-19T21:38:48.010
11

I have a form where users scan in a barcode, the barcode reader automatically enters a carriage return in the value causing the form to submit since the browser chooses the first button as the default. How can I disable anything from happening when the enter key is pressed when entring a value in that textbox?

Edit
Report

1 Answer

0
    private void textbox1_KeyUp(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.Enter)
        {

// do nothing

        }
    }

this may help you

answered 2009-12-19T21:44:02.043

Your Answer