Similar to a textbox control, if the user needs to input "123", "ABC"... Want to in the input after complete trigger an event handler,
Note you have modified control value, input trigger in the full
If use the TextChanged, change every character, and use Validated, no matter whether changes are triggered,
I use now is in the TextChanged event record value has changed, if check to have changed in the event of Validated further processing, can you tell me is there a more direct way?
CodePudding user response:
What is the input complete?
Or receiving enter the trigger
CodePudding user response:
reference 1st floor Bridge_go response: what input is complete?Either received enter trigger Complete input means such as input "123", must be entered the "123" when triggered, it not trigger input "1", Receive the enter trigger such change the user's operation habit, may accept, CodePudding user response:
Judge for yourself bai, less than the length of your content directly jump out, record the last words with the comparison of the content of the different do processing CodePudding user response:
1. Define a global variable: Private string global_str; 2. Assume that the control name is txtName 3. Write the following code in the MouseLeave event: Private void txtName_MouseLeave (object sender, EventArgs e) { String name=this. TxtName. Text. The Trim (); //judge the user input is not empty, and the new input value is not equal to the global variables defined if (name !=string. The Empty & amp; & ! Name. The Equals (global_str)) { //perform input change here after you to execute the code } } CodePudding user response:
Can refer to a text box focus leaves, caused the event, if you want to use the enter key, events have matching the enter key code Private void Form1_KeyDown (object sender, KeyEventArgs e) { If (e.K eyCode==Keys. Enter) { //... CodePudding user response:
reference 4 floor of the left hand write love reply: 1. Define a global variable: Private string global_str; 2. Assume that the control name is txtName 3. Write the following code in the MouseLeave event: Private void txtName_MouseLeave (object sender, EventArgs e) { String name=this. TxtName. Text. The Trim (); //judge the user input is not empty, and the new input value is not equal to the global variables defined if (name !=string. The Empty & amp; & ! Name. The Equals (global_str)) { //perform input change here after you to execute the code } } Change, forget to give the global variable assignment Private void txtName_MouseLeave (object sender, EventArgs e) { String name=this. TxtName. Text. The Trim (); //judge the user input is not empty, and the new input value is not equal to the global variables defined if (name !=string. The Empty & amp; & ! Name. The Equals (global_str)) { //save the new variable values Global_str=name; //perform input change here after you to execute the code } } CodePudding user response:
What input is complete? You need to have a clear and precise definition is good design and development, not just simple, for example, met a lot of this kind of demand, the customer may not understand technology, couldn't say for sure what you want to, or fail to describe what he wanted, the programmers did a he felt no, then made a or not, there are always new requirements emerge, programmers tired half to death, finally air strike table with the customer, CodePudding user response:
Binding the enter events, press enter to perform perform operations CodePudding user response:
The building Lord see me just the solution directly, because my software to use, so no problem! CodePudding user response:
In the textbox looses focus event processing CodePudding user response:
Not achieve complete definition input incomplete MouseLeave? Forgive my ignorance, really don't understand