Textbox beeping when pressing enter key, tried e.Handled=true but does not fix this!
Posted on 2005-04-04
Here the code snippet after trying hard to get rid of the beeping and removing \r\n key entry when multiline=true (as way of getting rid of the beep). Is there better way for entering numberic data into box than the textbox...it seem strange that textbox nor richtextbox does not have event feature when entry is completed (via return key or unfocused). What is the best entry box in the world?.
Here the code snippets, I found it does not immediently generates beep until end of the program, is there way of disabling that but keep beep for other code?.
private void Agl_Set_Amp_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
e.Handled=true; //will not work to remove the beep!
string datas=Agl_Set_Amp.Text.Trim(); //remove space
datas.Trim('\r'); //this will not work well since it won't remove it in the middle !! investigating alternative method.
int datai=Tools.ConversionStringtoInterger(datas); //contain try and exception trap (via interface) for non numberic data (System.Convert.Int32(string datas)).
if (datai==-975579) //the chance of having same value is very very very tiny, hence use this as error...assumed!
double dataf=Math.Round(myAgl.VoltageAmp*1000); //restore value if data invalid.
double dataf = System.Convert.ToDouble(datai); //convert interger into float
myAgl.AglVert_F_Ampitude("SET"); //Program instrument via interface protocol (seperates class).
AglOut_Refresh_Active_Channel_Display(); //Update display.