[英]ListBox.Selected is not working; Run-time error '-2147024809(80070057)
[英]Listbox.Selected shows run time error '-2147024809(80070057)'
我有一个设置为 multi select 的列表框。当我使用 listbox.selected 检查项目选择状态、我得到运行时错误。 运行时错误“-2147024809(80070057)”:无法获取所选属性。 无效的论点。
列表框中设置了 55 个项目。 当 i=25 时,错误发生。 这个错误的原因是什么?
' Add item to listbox
with me
For i = LBound(arr) To UBound(arr)
.ListBox1.AddItem arr(i)
Next
End With
' Check listbox
with me
arr = Array()
For i = 0 To .ListBox1.ListCount - 1
If .ListBox1.Selected(i) = False Then <-Error happen here
ReDim Preserve arr(UBound(arr) + 1)
arr(UBound(arr)) = .ListBox1.List(i)
End If
Next
End With
重新创建表单和所有相关处理后错误消失,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.