I'm working on a user control that will accept and validate an address. The addresses are all within a specific domain (in particular, Australia).
In the address user control I've got three fields: suburb, state and postcode (aka zip code).
When the user types part of a suburb name and hits TAB and moves into the state field, I query the database to see if I can make sense of the partial suburb. If I can, I fill in the complete suburb, state and postal code for them. As an example, there's only one suburb in Australia called "BORONIA", so the user can type "BORON", hit TAB and the form is populated with "BORONIA", "VIC" and "3155".
The issue I've got is that after I've filled these fields in I want to skip over the state and postal code fields and move on to the next control on the form. Because these address fields are in a user control, I effectively want to set focus to the next control on the parent form.
I know what that control is, but neither .Focus() nor .Select() appears to move the focus. The database query and field filling is done in the Enter event of the state field.
I had an earlier version of the same address handling logic that was NOT a user control: it was all inline on the data entry form, and in that situation everything worked fine. In the Enter method of the state field I could pass control to the next field.
When I've refactored this into a user control, however, it's failing. Can anyone nudge me in the right direction?
EDIT: I should note that I can pass the focus to other controls within my user control, so I know that the basic logic is correct. That's why I believe this is about user controls and parent controls, not my control selection and .Select() call.