Saves the contents of a DataWindow, DataStore, graph, OLE control, or OLE storage in a file. The syntax you use depends on the type of object you want to save.
For DataWindow and DataStore syntax, see the SaveAs method for DataWindows in the DataWindow Reference or the online Help.
To |
Use |
---|---|
Save the data in a graph |
|
Save the OLE object in an OLE control to a storage file |
|
Save the OLE object in an OLE control to a storage object in memory |
|
Save an OLE storage and any controls that have opened that storage in a file |
|
Save an OLE storage object in another OLE storage object |
Syntax 5 For saving an OLE storage object in another OLE storage |
Saves the data in a graph in the format you specify.
Graph controls in windows and user objects, and graphs in DataWindow controls and DataStores
controlname.SaveAs ( { filename, } { graphcontrol, saveastype, colheading } )
Argument |
Description |
---|---|
controlname |
The name of the graph control whose contents you want to save or the name of the DataWindow DataStore containing the graph. |
filename (optional) |
A string whose value is the name of the file in which you want to save the data in the graph. If you omit filename or specify an empty string (""), PocketBuilder prompts the user for a file name. |
graphcontrol (DataWindow control only) (optional) |
A string whose value is the name of the graph in the DataWindow control or DataStore whose contents you want to save. |
saveastype (optional) |
A value of the SaveAsType enumerated datatype specifying the format in which to save the data represented in the graph. Values are:
|
colheading (optional) |
A boolean value indicating whether you want column headings with the saved data. The default value is true. Colheading is ignored for DIF files; column headings are always saved. |
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is null, SaveAs returns null.
You must use zero or three arguments. If you do not specify any arguments for SaveAs, PocketBuilder displays the Save As dialog box, letting the user specify the format of the saved data.
Regional settings
If you use date formats in your graph, you must verify that yyyy
is
the Short Date Style for year in the Regional Settings of the user’s
Control Panel. Your program can check this with the RegistryGet function.
If the setting is not correct, you can ask the user to change it manually or to have the application change it (by calling the RegistrySet function). The user may need to reboot after the setting is changed.
This statement saves the contents of the graph gr_History. The file and format information are not specified, so PocketBuilder prompts for the file name and save the graph as tab-delimited text:
gr_History.SaveAs()
This statement saves the contents of gr_History to the file \WINDOWS\HR\EMPLOYEE.HIS. The format is CSV without column headings:
gr_History.SaveAs("\WINDOWS\HR\EMPLOYEE.HIS",CSV!,& FALSE)
This statement saves the contents of gr_computers in the DataWindow control dw_equipmt to the file G:\INVENTORY\SALES.XLS. The format is Excel with column headings:
dw_equipmt.SaveAs("gr_computers", &
"G:\INVENTORY\SALES.XLS", Excel!, TRUE)
Saves the object in an OLE control in a storage file.
OLE controls
olecontrol.SaveAs (OLEtargetfile )
Integer. Returns 0 if it succeeds and a negative number if an error occurs.
Saves the object in an OLE control to an OLE storage object in memory.
OLE controls
olecontrol.SaveAs ( targetstorage, substoragename )
Integer. Returns 0 if it succeeds and a negative number if an error occurs.
Saves an OLE storage object to a file. If OLE controls have opened the OLE storage object, this syntax of SaveAs puts them in a saved state too.
OLE storage objects
olestorage.SaveAs (OLEtargetfile )
Integer. Returns 0 if it succeeds and a negative number if an error occurs.
Saves an OLE storage object to another OLE storage object variable in memory.
OLE storage objects
olestorage.SaveAs ( substoragename, targetstorage )
Integer. Returns 0 if it succeeds and a negative number if an error occurs.