ListBox.Text 屬性

定義

取得或搜尋 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; }
[<System.ComponentModel.Bindable(false)>]
[<System.ComponentModel.Browsable(false)>]
member this.Text : string with get, set
Public Overrides Property Text As String

屬性值

控制項中目前選取項目的文字。

屬性

備註

當此屬性的值設定為字串值時,會在 ListBoxListBox 搜尋符合指定文字的專案,並選取專案。 您也可以使用這個屬性來判斷 目前在 中 ListBox 選取的專案。 SelectionMode如果 的 ListBox 屬性設定為 SelectionMode.MultiExtended ,這個屬性會傳回第一個選取專案的文字。 SelectionMode如果 的 ListBox 屬性未設定為 SelectionMode.None ,這個屬性會傳回第一個選取專案的文字。

適用於