views:

21

answers:

1

I'm using NSBasic/CE 7.0 and I'm needing to copy a file, but I don't know how to copy using this program, but at the time I already have this:

AddObject "cecomdlg.commondialog.1", "ComSvDlg", 0, 0, 0, 0

Sub saveDialog()
  ComSvDlg.CancelError = 0
  ComSvDlg.DialogTitle = "Copy"
  ComSvDlg.Filter = "All Files|*.*"
  ComSvDlg.ShowSave
  If Err.Number = 0 Then
    txtFileName = ComSvDlg.FileName
    MsgBox txtFileName
    ElseIf Err.Number = 32755 Then
      MsgBox "Canceled"
  End If
  KillFocus
End Sub

Sub mnuSave_Click
  saveDialog
  txtOutput.Text = ComSvDlg.FileName
End Sub

But one of the most important(copy) I don't know how to do. Could you help me to copy the file from \test.txt to ComSvDlg.Filename?

+1  A: 

According to information on the NS Basic/CE web site, it includes the following objects that provide the file system management functionality:

To copy a file, you can use either the FileSystem.FileCopy method or the SFMain.CopyFile method. The code should look like this (not tested, as I don't have NS Basic):

''# Using the FileSystem object
AddObject "FileSystem", "FS"
FS.FileCopy "\test.txt", ComSvDlg.FileName

''# Using the SFMain object
AddObject "newObjects.utilctls.SFMain", "FS"
FS.CopyFile "\test.txt", ComSvDlg.FileName
Helen