为什么listbox在选中一项的时候SelectedIndex是正确的,但是删除的时候就自己变成了-1?
1条回答 默认 最新
- Null_Reference 2021-07-01 15:13关注
-1 说明没有选择任何一项
// // 摘要: // Gets or sets the zero-based index of the currently selected item in a System.Windows.Forms.ListBox. // // 返回结果: // A zero-based index of the currently selected item. A value of negative one (-1) // is returned if no item is selected. // // 异常: // T:System.ArgumentOutOfRangeException: // The assigned value is less than -1 or greater than or equal to the item count. // // T:System.ArgumentException: // The System.Windows.Forms.ListBox.SelectionMode property is set to None.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报