0
0

I know this isn’t directly related to fmod but its for my app that used fmod.

How can I save a listview list to a file. I need code to be able to read it also. I’m new to Delphi (switch from VB) so any help is appreciated.

I tried out this http://www.igather.com/components/savelistview.htm
but couldnt get the demos to work correctly. I’m using Delphi 7 so that may be the problem.

Any help is appreciated.

  • You must to post comments
0
0

That’s what I use (in VB but can help):

[code:2wmb9xg9]Public Function ListeEnregistrer(FichierListe As String, Sortant As Boolean) As Boolean
With Form1
On Error GoTo Err
LstCount = .ListView1.ListItems.count
If LstCount = 0 And Sortant = False Then
Call MsgBox("Il n’y a aucun fichier!" & vbNewLine & vbNewLine & "Enregistrement annulé", vbCritical, "Enregistrement d’une liste")
Exit Function
End If
FreeF = FreeFile
Open FichierListe For Output As #FreeF
For i = 1 To LstCount
Print #FreeF, .ListView1.ListItems(i).Text
Print #FreeF, .ListView1.ListItems(i).ListSubItems(5).Text
Next i
Close #FreeF
End With
Exit Function
Err:
If Sortant = True Then Exit Function
Call MsgBox("Enregistrement annulé" & Chr(13) & Error, vbCritical, "Enregistrement d’une liste")
On Local Error Resume Next
Close #FreeF
End Function

Public Function ListeCharger(FichierListe As String) As Boolean
ListeCharger = False
On Error GoTo Err
If FileLen(FichierListe) = 0 Then Exit Function
With Form1
.ListView1.ListItems.Clear
FreeF = FreeFile
Open FichierListe For Input As #FreeF
Do While EOF(FreeF) = False
Dim fee As String
Dim fee1 As String
Line Input #FreeF, fee
Line Input #FreeF, fee1
AjouterFichier fee, fee1
Loop
Close #FreeF
End With
ListViewIndex 1
ListeCharger = True
Exit Function
Err:
Call MsgBox("Chargement annulé" & Chr(13) & Error, vbCritical, "Chargement d’une liste")
On Local Error Resume Next
Close #FreeF
End Function[/code:2wmb9xg9]

  • You must to post comments
0
0

I found what I needed. Thanks though.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.