key up event

I have a basic key up event so when you hit enter on the keyboard it will send the data to a remote server, but everytime you hit enter there is a beep the code runs fine but how do I stop the beep

thanks



Answer this question

key up event

  • SoniaJulka

    none of the above worked, could it be a focus problem
  • msteensen

    could it be to do with your Windows theme applied (or even sound settings) as I cannot seem to reproduce this "annoyence"

    another suggestion, for now, would be to have a button to do the login, but when the user presses enter, just call the button_click event instead to do the login. Do you have to have the enter key pressed to do the login/process

    just asking general questions to see if we can find perhaps a better solution overall

     

    you also may want to set the "Handled" property of the keyeventargs to true and see if this helps

     

     



  • Jughead1111

    ok I got it figured out here is what I did

    like you said I created a button, and set its visible to false, then in each textbox I set AcceptsReturns to true, and then set the AcceptButton on the form to the button that I created

    now there is no sound

    thanks for the help pointing me into the right direction


  • Ken_Bussell

    can you show us the code

    where is this keyup event implemented on a form a UI control



  • JohnDB

    no worries! :-) glad you got it sorted

  • Stuby085

    its in the textbox control

    private void Login_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)

    {

    if(e.KeyCode==Keys.Enter)

    {

    if(txtlogin.Text=="")

    {

    lblinfo.Text = "Enter login name";

    return;

    }

    else if(txtpass.Text=="")

    {

    lblinfo.Text="Enter password";

    return;

    }

    else

    {

    main.send_data("01," + txtlogin.Text + "," + txtpass.Text);

    }

    the code runs fine its the beep that drives me nuts and have no Idea how to get rid of it, its the same beep that you hear when you pop up a messagebox


  • Roberto Erazo

    one thing to note is this only happends when the enter key is pressed but the if I break the code at

    if(e.KeyCode == Keys.Enter)

    the sound happends before this...


  • key up event