Private Sub btnBackup_Click
Dim Filename As String = "persons.csv"
Dim data As List = DBModule.GetAllPersons2
Dim count As Int = data.Size
If count > 0 Then
'save as CSV file format
su.SaveCSV(Folder,Filename,",",data)
'now read the CSV file bytes
Dim b() As Byte = File.ReadBytes(Folder,Filename)
Dim inp As InputStream
inp.InitializeFromBytesArray(b,0,b.Length)
'save to where the user wants to save the file
'Wait For (fh.SaveAs(inp,"text/csv",Filename)) Complete (Success As Boolean) '<=== old code line
Wait For (fh.SaveAs(inp,"text/csv",Filename)) Complete (res As LoadResult) '<=== new code line
If res.Success Then '<=== changed
Dim resRealname As String = res.RealName '<=== new code line to get the actual filename
'Log("resRealname: " & resRealname)
DBModule.AddEventHistory("BACKUP",count,resRealname)
MsgboxAsync(count & " Person records backed up." & CRLF & "Backup File: " & resRealname,"Attention")
IME.HideKeyboard
'Else
'ToastMessageShow("File not saved.", False)
End If
Else
MsgboxAsync("No Person records to backup.","Attention")
End If
End Sub