[英]Listbox.Selected shows run time error '-2147024809(80070057)'
I have a listbox which is set to multi select. When I use listbox.selected to check the item selection status、I get the run time error.我有一个设置为 multi select 的列表框。当我使用 listbox.selected 检查项目选择状态、我得到运行时错误。 Run-time error '-2147024809(80070057)':Could not get selected property.运行时错误“-2147024809(80070057)”:无法获取所选属性。 Invalid argument.无效的论点。
There are 55 items set in the listbox.列表框中设置了 55 个项目。 And when i=25, the error happens.当 i=25 时,错误发生。 What is the cause of this error?这个错误的原因是什么?
' 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
The error disappeared after recreating the form and all related processing,重新创建表单和所有相关处理后错误消失,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.