c# listbox控件

来源:百度知道 编辑:UC知道 时间:2024/06/16 14:59:56
selectedItems 和 selectedIndices
前者是返回集合所有项
后者是返回集合所有项索引
请问有什么区别啊

【hello】 index=0 selectItem.value="Hello";
【world】 index=1 selectItem.value="world";

项通常不是我们要获取的,

selectItem 返回一个ListItem 包括ListItem。text 和listItem.value;

selectedItems返回集合中的所有项,项中可包括许多它具有的属性如文本Text等,
而selectedIndices是获取一个索引的集合,仅仅只包括所有当前选定的项的索引值