ListBox.ObjectCollection.Item 属性

获取或设置集合中指定索引处的项。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public Overridable Default Property Item ( _
    index As Integer _
) As Object
用法
Dim instance As ObjectCollection
Dim index As Integer
Dim value As Object

value = instance(index)

instance(index) = value
public virtual Object this [
    int index
] { get; set; }
public:
virtual property Object^ default [int] {
    Object^ get (int index);
    void set (int index, Object^ value);
}
/** @property */
public Object get_Item (int index)

/** @property */
public void set_Item (int index, Object value)
JScript 支持使用索引属性,但不支持进行新的声明。

参数

  • index
    集合中要获取或设置的项的索引。

属性值

一个对象,它表示集合内位于指定索引处的项。

异常

异常类型 条件

ArgumentOutOfRangeException

index 参数或者小于零,或者大于或等于 ListBox.ObjectCollection 类的 Count 属性的值。

备注

可以使用此方法获取在集合内特定位置存储的 ListBox 项。若要确定集合中特定项的索引,请使用 IndexOf 方法。

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

ListBox.ObjectCollection 类
ListBox.ObjectCollection 成员
System.Windows.Forms 命名空间