SaveFileDialog

zack

Well-known member
Joined
Jun 9, 2005
Messages
65
Programming Experience
Beginner
Hi, I going to start on a project soon and I need some basic skills to start with... I'm looking for examples on SaveFileDialog, do you have any that can show me?
 
VB.NET:
Dim sfdSave As New SaveFileDialog
Dim dlgResult as DialogResult
With sfdSave
	.Filter="Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
	.FileName = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\"
	.DefaultExt = ""
	.Title = "Save the File"
	dlgResult = .ShowDialog()
End With
If dlgResult <> DialogResult.Cancel Then
	'do file save stuff
End If
 
Just be aware that the Compact Framework does not support all the properties and methods that the full .NET Framework does. DefaultExt and Title are not supported by the CF. The member listing for all classes explicitly notes each member that is supported by the CF.
 
It'll be best you have examples that you can show, so that i can refer to? Sorry for the trouble caused.
 
The example that JuggaloBrotha has provided is fine, except that you will need to remove the lines that set the DefaultExt and Title properties to use it on the CF.
 
actually those are supported by the CF as i've used them on it without any errors

so either they're supported or things like DefaultExt doesn't throw any exceptions
 
JuggaloBrotha said:
actually those are supported by the CF as i've used them on it without any errors

so either they're supported or things like DefaultExt doesn't throw any exceptions
Never having used the CF myself, I can only go by what the documentation says. Neither of those properties is marked as being supported. I'd be interested to know, if no exception is thrown, whether they function as expected when you use them on the CF or are they simply ignored?
 
hi can anyone help in the previous thread that I send? Cuz that's my piority for my project. Thanks!
 
JuggaloBrotha said:
jmcilhinney i've tested the savefile dialog on the CF and it works the same as on the full framework
Most interesting, and thanks for following up. I guess the moral of the story is to try whatever members you want to use on the CF and then look for an alternative if they don't work.
 
well i figured that microsoft would have a list of all the "basic" controls in the CF and why wouldnt the Open/Save/Print dialog's be in there

but yes, build apps normally then test them on the CF and only change them if something doesnt work
 
The dialogues themselves are there for sure, but check out this help topic. Notice that some members are annotated as being supported but the Title and DefaultExt properties are not. Perhaps an oversight, I guess.
 
Back
Top