I want to make a list, and when you click on one of the items, it will give you an explanation. How do I make this save as one file instead of each having its own file?
Printable View
I want to make a list, and when you click on one of the items, it will give you an explanation. How do I make this save as one file instead of each having its own file?
Is this something where you could use the resource file editor to store the descriptions? Then when the user clicks the item, load the string that is associated with it into a messagebox or balloon help or whatever?
You need two lists.
One for the items and one the comments.
Hope you understand.Code:Public Sub List_Load(TheList As ListBox, FileName As String)
'// Loads a file to a list box
On Error Resume Next
Dim TheContents As String
Dim fFile As Integer
fFile = FreeFile
Open FileName For Input As fFile
Do
Line Input #fFile, TheContents$
Call List_Add(TheList, TheContents$)
Loop Until EOF(fFile)
Close fFile
End Sub
Public Sub List_Save(TheList As ListBox, FileName As String)
'// Save a listbox as FileName
On Error Resume Next
Dim Save As Long
Dim fFile As Integer
fFile = FreeFile
Open FileName For Output As fFile
For Save = 0 To TheList.ListCount - 1
Print #fFile, TheList.List(Save)
Next Save
Close fFile
End Sub
In the lists:
List1:
On Error Resume Next
List2.ListIndex = List1.ListIndex
'You could also make some text popup telling you:
'Msgbox list2
'Or something like that