I've been having some issues getting and setting the Focus on a RadTextBox control.
What's the best way to do this? Use the .Focus or the .Select method to set it?
This forum contains some conflicting info:
1. http://www.telerik.com/community/forums/winforms/editors/radtextbox-focus.aspx => "In order to set the focus to a RadTextBox when the form is loaded, please call its Select() method"
2. http://www.telerik.com/community/forums/winforms/ui-controls/radtextbox-focus.aspx => "Yes, you can use the Focus method exactly as with MS textbox."
Which one of the following properties is appropriate to get the control with the current focus?
- RadTextBox.Focused
- RadTextBox.TextBoxElement.IsFocused
- RadTextBox..TextBoxElement.TextBoxItem.IsFocused
Greetings,
Jan
11 Answers, 1 is accepted
Thank you for the question.
The Focus or Select methods may or may not work depending on the place where they are called. For example you can select MS TextBox only if you call Select in the form constructor:
However, if you want to call Focus method, you should do it at Form_Shown. Otherwise, you will not focus the textbox.
Considering the fact that we are hosting the standard TextBox in RadTextBox, you can set the focus to RadTextBox by calling the Select method of the hosted control:
public
Form1()
{
InitializeComponent();
this
.radTextBox1.TextBoxElement.TextBoxItem.HostedControl.Select();
}
The other way to set the focus to RadTextBox is by calling the Focus method of the hosted control in the Form_Shown:
void
Form1_Shown(
object
sender, EventArgs e)
{
this
.radTextBox1.TextBoxElement.TextBoxItem.HostedControl.Focus();
}
I hope this helps.
Sincerely yours,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

Thank you for writing.
In the versions prior to Q3 2011 you should use RadTextBox's hosted control, for example
this
.radTextBox1.TextBoxElement.TextBoxItem.HostedControl.Select();
In Q3 2011 you can call directly RadTextBox's Focus method or RadTextBox's Select method.
I hope this helps.
Regards,
Peter
the Telerik team
Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

Thank you for the update. I have managed to get it working with the select method after installing Q3 2011.
Thanks
I am happy to hear that you managed to get it working.
Do not hesitate to write me back if you have further questions.
Peter
the Telerik team
Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

I'm trying to know if radTextBox is focused - on client side,
the radTextBox.Focused rerturns 'false', but the "_focused" property holds 'true' (which is private property and I can't have this value)
is there any way to get the right indication about this textBox focusing??
It's very important to me!
thanks!
Niska.
The 'client side' phrase make me think that your question is related to our ASP.NET suite. If this is so, please open a new thread in the appropriate forum section as the current section is for RadControls for WinForms only.
Thank you for your understanding.
Nikolay
the Telerik team

"Is this really the only way to set the focus of the textbox?"
Control.Focus has been around for years and is therefore intuitive. Please consider sparing us the implementation details and encapsulating that mess for use by creating a public "Focus" method that does whatever internal call needed. This is the purpose behind "Information Hiding", see http://en.wikipedia.org/wiki/Information_hiding .
</soapbox>
Thank you for writing.
As my colleague Peter mentioned in one of his previous responses, the Focus method has been introduced in Q3 2011 and it works just like it does for the standard TextBox control. Still, you are right that there is an issue after all - the Focus method is not currently visible in the code editor. We will address this accordingly. You should have no issues, however, if you explicitly type "Focus()" after a RadTextBox instance. In other words, you will not get any compile errors and the method will work as expected.
I hope this clarifies the situation.
Nikolay
the Telerik team

Hi,
how to set focus on the Radtextbox in edge browser
Thank you for writing.
This thread is discussing the RadTextBox for WinForms. Please check the product you are using and post your question in the proper forums.
I hope this helps.
Regards,
Hristo
Progress Telerik