I have TextBox placed on a UserControl on a Panel which is placed in a Form. But couldn't set focus by this code,
mytxtBox.Focus();
ActiveControl = mytxtBox;
mytxtBox.Select();
Why its not working? How to set focus here?
I have TextBox placed on a UserControl on a Panel which is placed in a Form. But couldn't set focus by this code,
mytxtBox.Focus();
ActiveControl = mytxtBox;
mytxtBox.Select();
Why its not working? How to set focus here?
If you wish to call this code from the Form you need to change the textbox modifiers property to public.
Then from the form you can call
userControl11.textBox1.Focus();