Home Forums WinForms controls Other WinForms controls Text Selection on Focus in WinTextBox Reply To: Text Selection on Focus in WinTextBox

User (Old forums)
Post count: 23064

The WinTextBox has the same behavior in both .NET1.1 and .NET 2.0 with our latest version (3.2.6403.0). The WinTextBox.TextBoxArea.SelectOnFocus is false by default. We just tested it.

So it is possible that you have a version that, for some reason, had a bug which made the behavior differ from one version of .NET to the other.

Unfortunately, in your case, you will have to set the SelectOnFocus to true everywhere.

The only other solution is to create a custom class deriving from WinTextBox, override the CreateTextBoxArea, set the SelectOnFocus to true in there, and then do a CTRL-SHIFT-H in your project, and replace all the Xceed.Editors.WinTextBox (and/or WinTextBox) with the name of this new class.

i.e :
using System;
using System.Collections.Generic;
using System.Text;
using Xceed.Editors;

namespace WindowsApplication29
public class AutoSelectWinTextBox : WinTextBox
protected override TextBoxArea CreateTextBoxArea()
TextBoxArea textBoxArea = base.CreateTextBoxArea();
textBoxArea.SelectOnFocus = true;

return textBoxArea;

Imported from legacy forums. Posted by André (had 275 views)