The code below retrieves an object from a listview, writes the data to a csv file then emails it. The first time through it works correctly but if I have it do it again without reloading the listview, the csv file is empty except for the header and ct.minutes is set to zero. The number of zeros equal the exact number of records so I know that it's stepping through the listview correctly.
B4X:
For i = 0 To lvcalls.Size - 1
ct.Initialize
ct = lvcalls.GetItem(i)
pline = ct.Ctype & "," & ct.Name & "," & ct.number & "," & ct.date & "," & ct.time & "," & ct.minutes
detailFile.WriteLine(pline)
Next
detailFile.Close
Another odd thing is if I create the csv files using 'File.DirInternal' and attach it to an email, the file appears to be attached but the attachment is missing when I receive it. The way I was able to receive the attachment is to create the file using 'File.DirDefaultExternal'. Dunno if that makes sense to anyone.
Another odd thing is if I create the csv files using 'File.DirInternal' and attach it to an email, the file appears to be attached but the attachment is missing when I receive it. The way I was able to receive the attachment is to create the file using 'File.DirDefaultExternal'. Dunno if that makes sense to anyone.
The mail application doesn't have access to your internal application folder. You can use the new Net library and send the mail from your application instead.
Yes I am Erel. As a test I displayed the first record of ct.name in a msgbox just before the For loop. The first time through it displayed the correct name and the second time through it was blank.