What I want to do is:
click on button1 in form1---> loads form2 ---->set focus to a textbox1 in form2 and show IBeam Cursor there.

I tried textbox1.Focus() in Load, but it only do it for the first time I click button1, when I click button1 again, it loads form2, if I type something now, it won't show in textbox1, I don't know where it goes, no cursor in textbox1 either.

Then I tried assigning textbox1 the lowest 'TabIndex' on form2, still won't work. Why? What else can I do?

9 Years
Discussion Span
Last Post by Cecilia_notes

Wayne, I just double checked, form2 is actually very simple, just one textbox, 1 label and 2 buttons, I did set tabIndex of the textbox to 0 and it is the only one in this form whose tabIndex is 0. What happened? Is there any workaround to achieve the same result?


I know how to do it now, instead of set focus Form_Load event, set it in Form_Activated event, because no Controls are visible at Form_Load and hence focus cannot be set. Still don't know why the tabindex method won't work though.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.