I'm converting a VB6 application to Winforms and in VB6 we frequently use a technique where certain textboxes are only made visible when specific values are entered in prior a textbox.
The problem is that the decision to make the textbox visible is only made in the Validating event at which point the next control to gain focus has already been determined. When we make the dependent textbox visible, the focus has already skipped over the control.
We were able to solve the problem in VB6 by placing an empty,transparent usercontrol between the two textboxes and in the usercontrol's gotfocus event stuff an extra TAB in the keyboard buffer. Surprisingly it works quite well. It even works when you shift-tab back. For some reason, the usercontrol is ignored and focus returns to the first textbox. Unsurprisingly, I'm hoping there is a better solution in Winforms.
Has anyone successfully dealt with this situation?