This documentation is archived and is not being maintained.

ComboBox.SelectionLength Property

Gets or sets the number of characters selected in the editable portion of the combo box.

[Visual Basic]
Public Property SelectionLength As Integer
public int SelectionLength {get; set;}
public: __property int get_SelectionLength();
public: __property void set_SelectionLength(int);
public function get SelectionLength() : int;
public function set SelectionLength(int);

Property Value

The number of characters selected in the combo box.


Exception Type Condition
ArgumentException The value was less than zero.


You can use this property to determine whether any characters are currently selected in the combo box control before performing operations on the selected text. When the value of the SelectionLength property is set to a value that is larger than the number of characters within the text of the control, the value of the SelectionLength property is set to the entire length of text within the control minus the value of the SelectionStart property (if any value is specified for the SelectionStart property).


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

ComboBox Class | ComboBox Members | System.Windows.Forms Namespace