|
-
Dec 11th, 2015, 09:37 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] which event to use to save TextBox text?
Hi Folks
I have a form with a TextBox control.
The text entered in the text box is saved to an object in the TextBox.Validated event handler.
When the user hits the save ToolStripButton the object is serialized and saved to the relevant file.
However, if the user edits the TextBox text, but does not leave the TextBox before clicking the save button then the TextBox events, such as Validated, Validating, LostFocus, etc, do not appear to occur, or at least do not occur before the save button Click event is raised and handled. This means that the edits to the text do not get saved to the object before the object is serialized and saved.
What event or series of operations is best to use to ensure that the most correct method is used and any changes to the TextBox Text are always saved?
Will I have to resort to using the TextBox TextChanged event, or even the KeyPress event, and saving the text every time any single char is changed??
Thanks
Thanks 
-
Dec 11th, 2015, 09:42 AM
#2
Re: which event to use to save TextBox text?
Put a call to Me.Validate in the save tool strip handler before doing anything else. That should force the control with the focus to validate itself first.
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Dec 11th, 2015, 09:59 AM
#3
Thread Starter
Hyperactive Member
Re: which event to use to save TextBox text?
Thanks 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|