Gets or sets the number of characters selected in control.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
You can use this property to determine if any characters are currently selected in the text box control before performing operations on the selected text. You can also use this property to determine the total number of characters (including spaces) that are selected when performing single character tasks in a for loop.
The following code example demonstrates how to use the property to determine if text is selected within the RichTextBox. This example requires that a RichTextBox control, named richTextBox1, has been added to the form. The example also requires that richTextBox1 contains text that is selected in the control.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.