I have code that is a SaveAs method of my SQlite database file using Backup and reopens the file. There is a trapping error if the directory is changed in the Save Dialog from the original directory. Is there a way to get the directory from of the SaveAsDialog class to put in a string property? I have the directory pointed to original document directory.
[code]// Save As a new user files
Dim dlg As New SaveAsDialog
Dim dbFile, dbFile1 As FolderItem
dlg.Title = “Save User File”
dlg.SuggestedFileName = "DBUser File "
dlg.Filter = FileTypes1.sqliteType
dbFile = dlg.ShowModal
//Create and Save new Named File and close original named file and keep i
If dbFile <> Nil Then
Dim DBSaveAs As FolderItem = GetSaveFolderItem(FileTypes1.sqliteType, dbFile.DisplayName)
If DBSaveAs <> Nil Then
Dim DBNewFile As New SQLiteDatabase
DBNewFile.DatabaseFile = DBSaveAs
If DBNewFile.CreateDatabaseFile Then
// Create Backup File for SaveAs
db.BackUp(DBNewFile, Nil, -1)
dbFile1 = SpecialFolder.Documents.Child("MyApplication").Child("User Files").Child(dbFile.DisplayName) //<- rewrite if the SaveAsDialog directory changed
// Open New Save As File and connect database
db.DatabaseFile = dbFile1
If db.Connect Then
OpenedFile = dbFile1.DisplayName
Else
MsgBox("Error: " + db.ErrorMessage)
End If
End If
End If
End If[/code]