I tried several ways, and I found the sequence:

(Megatron, your suggestion get the same result)

if I set the container in form_load, it will not work.

if I put it in a command button and manual press the button, it works

if I call Command1_Click inside Form_Load, it do not work (disregard whether I put DoEvents in between)

if I set the form to KeyPreview and SendKeys inside Form_Load, and then inside Form_KeyPress set the Container, then it works.

Do you have any suggestions?

Besides, would you tell me about the second question, i.e. how can I know which tab page it is that a control is placed.

Thanks