通用的Access列錶框全選 全不選 反選的函數

2017-08-27 15:24:00
zstmtony
原創
1236

來源:Access交流網通用開髮平颱函數

作者:tmtony


'列錶框全選函數

Public Function gf_SelectAll(lst As ListBox)
If lst.ListCount = 0 Then Exit Function
Dim i As Integer
For i = 0 To lst.ListCount - 1
lst.Selected(i) = True
Next
End Function

'列錶框不全選函數
Public Function gf_DeSelect(lst As ListBox)
If lst.ListCount = 0 Then Exit Function
Dim i As Integer
For i = 0 To lst.ListCount - 1
lst.Selected(i) = False
Next
End Function

'列錶框反選函數
Public Function gf_Reverse(lst As ListBox)
If lst.ListCount = 0 Then Exit Function
Dim i As Integer
For i = 0 To lst.ListCount - 1
lst.Selected(i) = Not lst.Selected(i)
Next
End Function
分享