GetFile to save to other DIR

tcgoh

Active Member
Licensed User
Hi all,

Can anyone help me to write a code to select a file in the Dir(eg. textall.dat) and safe it to another Dir?

I tried SaveDialog but the filename field is emty. I wanted filename field to be fill up w/o letting the user select.

Thanks
TC
 

specci48

Well-Known Member
Licensed User
I tried SaveDialog but the filename field is emty. I wanted filename field to be fill up w/o letting the user select.
To preselect a filename in the savedialog you have to define the file property of the savedialog before showing it, e.g.:
B4X:
   SaveDialog1.File = AppPath & "\test.txt"
   SaveDialog1.Show
specci48


Edit: added a very simple copy sample...
 

Attachments

Last edited:

tcgoh

Active Member
Licensed User
To preselect a filename in the savedialog you have to define the file property of the savedialog before showing it, e.g.:
B4X:
   SaveDialog1.File = AppPath & "\test.txt"
   SaveDialog1.Show
Hi specci48 and Erel

Thanks for the code and help. The Savedialog1.file=AppPath &"\test.txt" helps, but the "text.txt" file in the "file name: box"(see attached jpg) is NOT SAVING to any directory? I don't understand why?

View attachment 2005

Thanks
 

Cableguy

Expert
Licensed User
Why not read the file to end and write the file again in the new dir, this way the user is not prompt in any way...
 

tcgoh

Active Member
Licensed User
Hi All,

Thanks for all that help here. I Have manage to pre-select the file to safe into another directory. (its a NO GO to read sl3 file and filewrite again)

However, appreciate if anyone can help to shortern the steps required to safe the selected file without having to show the openDialog.

Thanks.
 

Cableguy

Expert
Licensed User
Posting the Actual code would help us Help you...How can we shorten the steps if we do not know the way you took?
 
Last edited:

tcgoh

Active Member
Licensed User
Thanks Cableguy, problem solved. Here the code

opendialog1.File = AppPath & "\alldata.sl3"
openDialog1.Filter = "sl3 DATA Files|*.sl3"

SaveDialog1.File = OpenDialog1.File

If SaveDialog1.Show = cCancel Then
Return
End If


FileCopy(OpenDialog1.File, SaveDialog1.File)

Thanks Again
 
Top