SelText: String;
The SelText property determines the text selected in the component.
This property returns the selected text that is shown starting with the SelStart position and that is SelLength characters long.
Setting this property, if there is selected text in the component, this text is changed. If there is no selection, the set value is added to the position, in which the cursor is placed.
Executing the example requires a form, a button named Button1 on it and the ComboBox component named ComboBox1.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
ComboBox1.SelStart := 3;
ComboBox1.SelLength := ComboBox1.Text.Length - 3;
ComboBox1.SelText := "New Value";
End Sub Button1OnClick;
After executing the example pressing the button changes a part of the text of the ComboBox1 component for the specified value.
See also: