arrow keys acting like tab key on controls added at runtime

Hi, Here's my code... I add a usercontrol to a form at runtime and add textboxes to a frame on the usercontrol. When the form loads however, the arrow keys on these textboxes act like tabs, moving the cursor to the next textbox. When user clicks on another control (added at design time) on the screen and come back to the textboxes, the arrow keys start behaving fine.
Any idea why this may occur, and how I could fix it?


Private WithEvents MyEditor As VBControlExtender

Set MyEditor = MyForm.Controls.Add("ctlMyUserControl", "MyEditor")
MyEditor.Visible = True

MyEditor.object.Controls.Add "VB.TextBox", "txtName", MyEditor.object.Controls("frameUserInfo")
MyEditor.object.Controls.Add "VB.TextBox", "txtAddress", MyEditor.object.Controls("frameUserInfo")
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I am not sure this will work, but try doing this in Form_Activate event....

cmdButton.SetFocus ' forcus to any design time conrol
SendKeys "{TAB}"
txtName.SetFocus ' now focus back to whereever you want

Good Luck!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
powerstreakAuthor Commented:
The form starts out empty...the usercontrol is loaded at runtime.
I sent a WM_LBUTTONDOWN message to an existing control on the usercontrol during Initproperties and it worked. Wish I'd known the underlying reason for this behaviour.
Thanks though, for sending me in the right direction.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.