Hello!
I want to find out how to safely set focus to a control after the user completes entry.
If the user has entered "0000", focus has to be set to a specific control; else the entry is checked, and if ok, some actions (adding records to a table in a dataset) are to be taken, and focus is to be set to a different specific control.
If I put this logic into Control.Leave, Control.leave fires again at the DifferentSpecificControl.focus(), causing the actions mentioned earlier to repeat and Exceptions due to duplicate keys thrown. (This does NOT happen at SpecificControl,.focus(), I am not clear why. Possibly because SpecificControl is the next in TabOrder?)
I put the whole logic into Control.Validating(), and it works.
But MSDN warns against using focus() in Validating event.
Can someone point out the correct way to branch to different controls depending on the entered values in SpecificControlTextbox?
I have a feeling I am missing something
Mohan
MohanSQL