Click here to Skip to main content
16,012,223 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I created a User control with the following controls.

SplitContainer - Panel1 - Richtextbox1
- Panel2 - Richtextbox2


I want to focus control of Richtextbox2 on formload.. How to set focus ?

Can anyone help me out?

I tried with this code..its not working

C#
splitContainer1.Focus();
splitContainer1.ActiveControl = Richtextbox2;
Posted

1 solution

You can't set the Focus to an control that can't accept user input.
So try this:
C#
richTextBox2.Focus();


But when I tried your code, both forms work fine...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900