Difference between revisions of "Microsoft Access modList"
Jump to navigation
Jump to search
(Created page with '=== storeList === <syntaxhighlight lang="vb"> Public Sub storeList(lst As ListBox) Dim strListIndices As String Dim strListValues As String Dim varIndex As Variant ...') |
(No difference)
|
Revision as of 11:19, 28 September 2010
storeList
Public Sub storeList(lst As ListBox)
Dim strListIndices As String
Dim strListValues As String
Dim varIndex As Variant
With lst
For Each varIndex In .ItemsSelected
strListIndices = strListIndices & ";" & varIndex
strListValues = strListValues & ";" & .ItemData(varIndex)
Next
If Len(strListIndices) > 0 Then
strListIndices = Mid(strListIndices, 2)
End If
SaveSetting getProjectName, "RunTime", .Name & ".ListIndices", strListIndices
If Len(strListValues) > 0 Then
strListValues = Mid(strListValues, 2)
End If
SaveSetting getProjectName, "RunTime", .Name & ".ListValues", strListValues
End With
End Sub
restoreListValues
Public Sub restoreListValues(lst As ListBox)
Dim strListValues As String
Dim varValues As Variant
Dim varValue As Variant
Dim varListIndex As Long
strListValues = GetSetting(getProjectName, "RunTime", lst.Name & ".ListValues", "")
varValues = Split(strListValues, ";", -1, vbTextCompare)
With lst
For varListIndex = 0 To .ListCount - 1
.Selected(varListIndex) = False
For Each varValue In varValues
If .ItemData(varListIndex) = varValue Then
.Selected(varListIndex) = True
Exit For
End If
Next
Next
End With
End Sub
=== restoreListIndices ===
<syntaxhighlight lang="vb">
Public Sub restoreListIndices(lst As ListBox)
Dim strListIndices As String
Dim varIndices As Variant
Dim varIndex As Variant
Dim varListIndex As Long
strListIndices = GetSetting(getProjectName, "RunTime", lst.Name & ".ListIndices", "")
varIndices = Split(strListIndices, ";", -1, vbTextCompare)
With lst
For varListIndex = 0 To .ListCount - 1
.Selected(varListIndex) = False
For Each varIndex In varIndices
If varListIndex = varIndex Then
.Selected(varListIndex) = True
Exit For
End If
Next
Next
End With
End Sub