ListBox.Text 属性

定义

获取或搜索 ListBox 中当前选定项的文本。Gets or searches for the text of the currently selected item in the ListBox.

public:
 virtual property System::String ^ Text { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Bindable(false)]
[System.ComponentModel.Browsable(false)]
public override string Text { get; set; }
member this.Text : string with get, set
Public Overrides Property Text As String

属性值

控件中当前选定项的文本。The text of the currently selected item in the control.

属性

注解

如果将此属性的值设置为字符串值,则 ListBox 搜索与指定文本匹配的 ListBox 中的项,然后选择该项。When the value of this property is set to a string value, the ListBox searches for the item within the ListBox that matches the specified text and selects the item. 你还可以使用此属性来确定当前在 ListBox中选择的项。You can also use this property to determine which items are currently selected in the ListBox. 如果 ListBoxSelectionMode 属性设置为 SelectionMode.MultiExtended,则此属性将返回选定的第一个项的文本。If the SelectionMode property of the ListBox is set to SelectionMode.MultiExtended, this property returns the text of the first selected item. 如果 ListBoxSelectionMode 属性未设置为 SelectionMode.None,则此属性返回选定的第一个项的文本。If the SelectionMode property of the ListBox is not set to SelectionMode.None, this property returns the text of the first selected item.

适用于