I must save a file with an extension of the type object.type.dat. How I make with savefiledialog?
Thanks.
Printable View
I must save a file with an extension of the type object.type.dat. How I make with savefiledialog?
Thanks.
VB Code:
Dim cdlg1 As New System.windows.Forms.SaveFileDialog Dim flnm As String Try If saveFileName = "" Then Do 'Get it. cdlg1.FileName = "" cdlg1.Filter = "Function Files (*.FNC)|*.FNC" cdlg1.CheckFileExists = False If cdlg1.ShowDialog() = DialogResult.Cancel Then Return False Else flnm = cdlg1.FileName End If Loop While flnm = "" saveFileName = flnm Else flnm = saveFileName End If
This is an incomplete piece of a function I have to save a specific type of file. It won't work as is, because saveFileName is not declared (it is global), but it should give you some ideas.
Notice that you cannot do quite what you want with the extensions: You can have .DAT appended automatically to any name, but that's all. To get the whole object.type.dat, you would probably want to just have object.type as the file name, and let the .dat be appended automatically.
I have made therefore.
If .ShowDialog = DialogResult.OK Then
Dim name = .FileName
Dim end = .FileName.LastIndexOf(".")
fil = Mid(fil, 1, fine - 0)
fil = fil & ".object.type.dat"
.......
That can be done. Is it working?
Yes.I have used this system why I have analyzed pages web and me the system of the mid() has seemed useful.