ComboBox.ListIndex 屬性 (Access)ComboBox.ListIndex property (Access)

您可以使用ListIndex屬性來判斷哪些項目已選取下拉式方塊中。You can use the ListIndex property to determine which item is selected in a combo box. 唯讀的 LongRead-only Long.

語法Syntax

運算式ListIndexexpression.ListIndex

_運算式_代表**ComboBox** 物件的變數。expression A variable that represents a ComboBox object.

註解Remarks

ListIndex 屬性是從 0 到清單方塊或下拉式方塊減 1 中的項目數總計的整數。The ListIndex property is an integer from 0 to the total number of items in a list box or combo box minus 1. Microsoft Access 設定 ListIndex 屬性值] 清單方塊或下拉式方塊的清單方塊部分中選取項目。Microsoft Access sets the ListIndex property value when an item is selected in a list box or list box portion of a combo box. ListIndex 屬性的值清單中的第一個項目是 0,第二個項目的值是 1,依此類推。The ListIndex property value of the first item in a list is 0, the value of the second item is 1, and so on.

此屬性是只能透過使用巨集或 Visual Basic 中。This property is available only by using a macro or Visual Basic. 只有在表單檢視和資料工作表檢視中才能讀取此屬性。You can read this property only in Form view and Datasheet view. 此屬性為唯讀,無法使用其他檢視中。This property is read-only and isn't available in other views.

ListIndex 屬性值也是可用來設定 BoundColumn 屬性為 0 下拉式方塊或清單方塊中。The ListIndex property value is also available by setting the BoundColumn property to 0 for a combo box or list box. 如果 BoundColumn 屬性設定為 0,結合的下拉式方塊或清單方塊的基礎資料表欄位會包含 ListIndex 屬性設定值相同。If the BoundColumn property is set to 0, the underlying table field to which the combo box or list box is bound will contain the same value as the ListIndex property setting.

清單方塊也可以讓使用者選取多個項目從控制項的 MultiSelect 屬性。List boxes also have a MultiSelect property that allows the user to select multiple items from the control. 當進行多重選擇清單方塊中時,您可以決定使用控制項的 Selected 屬性來選取哪些項目。When multiple selections are made in a list box, you can determine which items are selected by using the Selected property of the control. Selected 屬性是從 0 到 ListCount 屬性值減 1 的值陣列。The Selected property is an array of values from 0 to the ListCount property value minus 1. 每個項目在清單方塊中,選取屬性會是true 是表示如果選取項目及False如果未選取。For each item in the list box, the Selected property will be True if the item is selected and False if it is not selected.

ItemsSelected 集合也提供一種方式來存取在清單方塊或下拉式方塊的選取資料列中的資料。The ItemsSelected collection also provides a way to access data in the selected rows of a list box or combo box.

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.