N
Nelson
Is there a faster way to select all items in an extended multiselect listbox
with a high ListCount than?
Me.Painting = False
For i = 0 To ProcedureList.ListCount - 1
ProcedureList.Selected(i) = True
Next i
Me.Painting = True
When ProcedureList.ListCount is higher than ~2000, the above procedure takes
10+ seconds.
Clicking on the first item, scrolling to the bottom and shift clicking on
the last item selects all items almost instantly so I tried to simulate that
in code. These attempts did not work but maybe they will give someone an
idea:
ProcedureList.SetFocus
hWndSB = GetFocus
ProcedureList.ListIndex = 0
SendKeys " "
ProcedureList.ListIndex = ProcedureList.ListCount - 1
SendKeys "+ "
ProcedureList.SetFocus
hWndSB = GetFocus
ProcedureList.ListIndex = 0
LngThumb = MakeDWord(SB_THUMBPOSITION, CInt(ProcedureList.ListCount - 1))
lngRet = SendMessage(hWndSB, WM_VSCROLL, LngThumb, 0&)
SendKeys "+ "
with a high ListCount than?
Me.Painting = False
For i = 0 To ProcedureList.ListCount - 1
ProcedureList.Selected(i) = True
Next i
Me.Painting = True
When ProcedureList.ListCount is higher than ~2000, the above procedure takes
10+ seconds.
Clicking on the first item, scrolling to the bottom and shift clicking on
the last item selects all items almost instantly so I tried to simulate that
in code. These attempts did not work but maybe they will give someone an
idea:
ProcedureList.SetFocus
hWndSB = GetFocus
ProcedureList.ListIndex = 0
SendKeys " "
ProcedureList.ListIndex = ProcedureList.ListCount - 1
SendKeys "+ "
ProcedureList.SetFocus
hWndSB = GetFocus
ProcedureList.ListIndex = 0
LngThumb = MakeDWord(SB_THUMBPOSITION, CInt(ProcedureList.ListCount - 1))
lngRet = SendMessage(hWndSB, WM_VSCROLL, LngThumb, 0&)
SendKeys "+ "