Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi guys i have problem i write update statement in text changed event.but repeated changed when any character changed
example
user name text box and has name ahmed and i need to change to ahmedsalah
it save in database as
ahmeds
ahmedsa
ahmedsal
ahmedsala
ahmedsalah
it save 5 times
how please to allow text box to save after finish typing
I have sql 2005
visual studio 2008
if possible help me
Posted
Comments
King Fisher 6-Apr-15 1:46am    
Is this about Asp.net?
Sascha Lefèvre 6-Apr-15 1:49am    
Don't save the input on each textchange, have a button "Save"/"Save changes" instead.
[no name] 6-Apr-15 1:56am    
you can use client side event on blur if this related to web development.
Suvendu Shekhar Giri 6-Apr-15 1:58am    
Really? As far I remember, textchanged event gets fired only when focus is shifted from the textbox and if so, it should do your job by default. If I am wrong, still I'll ask "what do you mean by save after finish typing ? how application come to know that you have finished typing ?"

The easiest way if to move the code from your TextChanged event to the Leave[^] event - as the user has finished input by then.

Alternatively, store it only when the login is successful - that way "amhedsalah" doesn't get stored either because the username isn't found in the login DB.
 
Share this answer
 
It makes no sense at all, just the dreadful UI idea. You should not do any active action on text changing event, as you make the user life a nightmare, and bloat Internet traffic and so on. Only the user knows when she/he finishes the entry, so only the user can trigger handling of the input string, with some click or keyboard hit (such as Enter).

Of course, there are some exclusions, such as the search in a dictionary. But this is a very specific case; moreover, it can only be applied to a local dictionary, not online.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900