How to use listbox with checkbox style how to store selected items in a single field and how to ret
How to use listbox with checkbox style how to store selected items in a single field and how to retrieve to select back
Rate How to use listbox with checkbox style how to store selected items in a single field and how to ret
(1(1 Vote))
'To Store selected Listbox items
Function GetSelected() As String
Dim str As String
str = ""
For i = 0 To List1.ListCount - 1
If List1.Selected(i) = True Then
'MID function is used becz listbox is loaded with more than one column
str = str & Trim(Mid(List1.List(i), 1, 6)) & ":"
End If
Next
If Len(str) > 0 Then
str = Mid(str, 1, Len(str) - 1)
Else
str = "No Equipment"
End If
GetSelected = str
End Function
'To Select back
Sub SelectItems(ste As String)
If ste = "No Equipment" Then
Else
Dim bs
bs = Split(ste, ":")
For i = 0 To UBound(bs)
For j = 0 To List1.ListCount - 1
If bs(i) = Trim(Mid(List1.List(j), 1, 6)) Then
On Error Resume Next
List1.Selected(j) = True
End If
Next
Next
End If
End Sub
How to use listbox with checkbox style how to store selected items in a single field and how to ret Comments
No comments yet — be the first to post one!
Post a Comment