Sign in to follow this  
Min0

C# winforms textfields input

Recommended Posts

First of all the situation:
I have all my program logic as one project (lets call it library in here) and then I m importing it into another project which serves the purpose of editor.
I want to set all the values retrieved from library into texfields and then, when I change the values in editor, values in library changes too.

The problem with all this is that if I m using "textChanged event handler" it changes too fast. Lets say if I wanna change from 0 to 99 it will remove the value (in library) once I delete 0 and then sets its at 9, then at 99 (most likely it would crash when I delete 0 since that would be invalid input).

What I want to find out is how can I control when these values are changed?
How can I control that the value is update only when I remore the focus from that textfield or once I press enter?

Share this post


Link to post
Share on other sites
Use the LostFocus event instead. Then you will know when they leave that control and move on to the next one. Then process the control.

Now with that being said, Your library is broken if it can't handle an invalid piece of data being thrown at it. You most likely want to go and change your library to handle values that are not valid, and then go back to using the TextChange events.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this