How do you save and load the contents of a list box to the registry.
To load i tried.
VB Code:
lstPC.List = GetSetting("NETWORK", "CLIENT", "UserList", "")
and to save i tried.
Code:SaveSetting "NETWORK", "CLIENT", "Userlist", lstPC.List
Printable View
How do you save and load the contents of a list box to the registry.
To load i tried.
VB Code:
lstPC.List = GetSetting("NETWORK", "CLIENT", "UserList", "")
and to save i tried.
Code:SaveSetting "NETWORK", "CLIENT", "Userlist", lstPC.List
BTW vbcode tags look better than code tags.VB Code:
Private Sub Form_Load() Dim strParts() As String Dim lngIndex As Long strParts = Split(GetSetting("NETWORK", "CLIENT", "UserList", ""), "||") For lngIndex = 0 To UBound(strParts) lstPC.AddItem strParts(lngIndex) Next End Sub Private Sub Form_Unload(Cancel As Integer) Dim strAccum As String Dim lngIndex As Long For lngIndex = 0 To lstPC.ListCount - 1 strAccum = strAccum & lstPC.List(lngIndex) & "||" Next strAccum = Left$(strAccum, Len(strAccum) - 2) ' if you use a one character delimiter instead of || then change to -1 SaveSetting "NETWORK", "CLIENT", "Userlist", strAccum End Sub
Thanks