SaveFileDialog Name

jamie_pattison

Well-known member
Joined
Sep 9, 2008
Messages
116
Programming Experience
Beginner
How could i show a SaveDialogBox with the name of the file that the user selected from the OpenFileDialog box (the purpose is to select a file then save it as another extension with the same name)?

Thanks
 
Did you read the documentation or see the Object Browser? (Ctrl+W, then J)

SaveDialogBox: no such thing

SaveFileDialog class
Inherited from FileDialog class

FileDialog.Title => "Gets or sets the file dialog box title."


-

Hence

VB.NET:
Dim ofd as New OpenFileDialog
ofd.Filter = "*.abc|ABC Files (*.abc)"
ofd.ShowDialog()

Dim folder as String
Dim filename as String
Dim newFilename as String
Dim newfullPath as String

folder = Path.GetDirectoryName(ofd.FileName)
filename = Path.GetFilename(ofd.FileName)
newFilename = Path.GetFileNameWithoutExtension(ofd.FileName) & ".def"
newFullPath = Path.Combine(folder, newFilename)

Dim sfd as New SaveFileDialog
sfd.Title = string.Format("Pick a location to save your new file {0}", newFilename)
sfd.FileName = newFullPath
ofd.Filter = "*.def|DEF Files (*.def)"
sfd.ShowDialog()
 
Last edited:
Back
Top