c# - Button_Click() Event fires twice in windows desktop application -


i creating form in search option provided this

i working in mdi form application.

my code :

 private void btnsearch_click(object sender, eventargs e)  {      string query = null;     if (txtbillno.enabled && txtbillno.text.trim().length != 0)     {         query = "select billno,partyname,city,state,format(billdt,'dd-mm-yyyy')as dt billmaster billno=" + convert.toint32(txtbillno.text.trim());         fillgrid(query);     }     else if (txtname.enabled && txtname.text.trim().length != 0)     {             query = "select billno,partyname,city,state,format(billdt,'dd-mm-yyyy')as dt billmaster ucase(partyname) '" + txtname.text.trim().toupper() + "'";             fillgrid(query);     }      else     {         messagebox.show("enter value first");          if (rdbname.enabled)         {             txtname.focus();          }         else if (rdbbillno.enabled)         {            txtbillno.focus();          }      }                   } 

the conditions checking whether text boxes left or not. if left blank giving message user must enter value. when running program prompts twice, debugged program , found click event called twice.

what should tackle problem.
please help.

in wpf have set e.handled true after fillgrid(query)
in win forms, delete , dont register btnsearch.click in load()


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -