office交流网--QQ交流群号

Access培训群:792054000         Excel免费交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

通用的Access列表框全选 全不选 反选的函数

2017-08-27 15:24:00
zstmtony
原创
5122

来源: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
分享