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

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

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