c# - textbox_leave event fires twice when click on combobox -


hi have used textbox_leave method in order validate textbox , if mouse clicked on control want show message box. code shown below.

private void txtbox_leave(object sender, eventargs e)   {   if(textbox.text != "this")   {  messagebox.show("not valid");  textbox.focus();    }  } 

the issue when click on combobox in form messagebox pop twice. if click on other control works fine. how can solve problem?

thanks in advance..

it more appropriate use combobox.selectedindexchanged or combobox.selectedvaluechanged validate value selected user combobox.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -