tcgoh Active Member Licensed User Longtime User Aug 4, 2008 #1 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
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
Erel B4X founder Staff member Licensed User Longtime User Aug 4, 2008 #2 Can you give an example of what you are trying to achieve?
specci48 Well-Known Member Licensed User Longtime User Aug 4, 2008 #3 tcgoh said: I tried SaveDialog but the filename field is emty. I wanted filename field to be fill up w/o letting the user select. Click to expand... 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 CopyFile.sbp 709 bytes · Views: 355 Last edited: Aug 4, 2008
tcgoh said: I tried SaveDialog but the filename field is emty. I wanted filename field to be fill up w/o letting the user select. Click to expand... 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...
tcgoh Active Member Licensed User Longtime User Aug 5, 2008 #4 specci48 said: 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 Click to expand...
specci48 said: 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 Click to expand...
Cableguy Expert Licensed User Longtime User Aug 5, 2008 #5 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...
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...
specci48 Well-Known Member Licensed User Longtime User Aug 5, 2008 #6 Cableguy said: Why not read the file to end and write the file again in the new dir... Click to expand... Just use filecopy
Cableguy said: Why not read the file to end and write the file again in the new dir... Click to expand... Just use filecopy
tcgoh Active Member Licensed User Longtime User Aug 6, 2008 #7 specci48 said: Just use filecopy Click to expand... Actually its a SQL file(sl3). Its about 2mb, haven't try yet, not sure it will work? will it? Thanks
specci48 said: Just use filecopy Click to expand... Actually its a SQL file(sl3). Its about 2mb, haven't try yet, not sure it will work? will it? Thanks
tcgoh Active Member Licensed User Longtime User Aug 8, 2008 #8 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.
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 Longtime User Aug 8, 2008 #9 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: Aug 8, 2008
Posting the Actual code would help us Help you...How can we shorten the steps if we do not know the way you took?
tcgoh Active Member Licensed User Longtime User Aug 9, 2008 #10 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
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