Jump to content
  • Advertisement
Sign in to follow this  
Min0

C# winforms textfields input

This topic is 2618 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!