I have a win form with lot of controls:
I want to know when user enters 'txt2' exactly after he entered 'txt1'开发者_StackOverflow. In other words when user is in 'txt2' I want to know was previous control 'txt1' or not.
What is the best way to such thing?
You could just keep a module-level variable of the type Control that stores the last control to receive focus. Since you need to keep track of each control which receives focus, each control needs to subscribe to a common event handler for the Enter event. In that event you will assign the control that has been entered to the module-level variable, but before that you can test for the jump between 'txt1' and 'txt2'.
精彩评论