I am attempting to add my own extension to a filename.
This doesn’t work.

Dim dlg as SaveFileDialog
Dim SelectedFileName as FolderItem
// other code
strTemp = SelectedFileName.Name
StrTemp = strTemp + “.RPL”
SelectedFileName.Name = strTemp

It saves the original filename.


you need to replace the Child of the last branch of the folder item with its new value

That gives me a “you must use the value returned by this function” error.



Thank you! I don’t think I would have ever figured that out!

This is not the right way to handle extensions + the save dialog. The system will give you the filename with or without the extension as desired by the user. The correct way would be to set up a filter for the save dialog featuring your extension. This will pass you an appropriately named FolderItem.

As an illustrative example, and written in the forum post editor so you may need to tweak

[code]dim tftRPL as new FileType
tftRPL.Extensions = “.rpl”
tftRPL.Name = “RPL”

dim tsd as new SaveFileDialog
tsd.Filter = tftRPL

dim tfSelected as FolderItem = tsd.ShowModal
tfSelected will have or not have the extension based on the user setting. This is the way saving works so fighting against it will make your app stand out as misbehaving.