FileName not showing in FileDialog

openfiledialog
c# openfiledialog filter
savefiledialog default filename
openfiledialog vb
openfiledialog restoredirectory
c# save file dialog default path
get file path from openfiledialog c#
save file c#

I am using the FileDialog class to ask a user to choose a file. The issue I am encountering is that while I set the file name for the user, it doesn't show up in the dialog. Is it a limitation of Cinnamon ? If I run this code on Windows, it works:

    final FileDialog dialog = new FileDialog(activeShell, SWT.OPEN);
    dialog.setText("Choose a file");
    dialog.setFilterPath("/home/frederic/Videos");
    dialog.open()

I am on the following environment : Debian 9

Cinnamon 3.2.7

openjdk version "1.8.0_212"

OpenJDK Runtime Environment (build 1.8.0_212-8u212-b01-1~deb9u1-b01)

OpenJDK 64-Bit Server VM (build 25.212-b01, mixed mode)

setFileName takes a file name parameter not a path. So

dialog.setFileName("doc.txt");

You use dialog.setFilterPath to set the initial directory path.

dialog.setFilterPath("/home/frederic/Documents");

FileDialog.FileName Property (System.Windows.Forms), Gets or sets a string containing the file name selected in the file dialog box. Text = "It will be added to the stream and appear here."; this. is only used when "All files" is selected from // the filter box and no extension is specified by the user. The file name includes both the file path and the extension. If no files are selected, this method returns an empty string (""). When used from the SaveFileDialog class, this property represents the file being saved; when used from the OpenFileDialog class, it represents the file being opened. This property can only be the name of one selected file.

It turned out that my hunch was right and that this issue has nothing to do with the FileDialog class but more with the desktop environment I am using (Cinnamon).

In order to show the path in the FileDialog, the key combination Ctr+L will make it appear (Source)

OpenFileDialog file name not correctly justified - MSDN, When creating an OpenFileDialog for a WPF app in Windows 7, the file name that I specify for the FileName property prior to showing the dialog  Dim fDialog As FileDialog Set fDialog = Application.FileDialog (msoFileDialogFilePicker) 'Show the dialog. -1 means success! If fDialog.Show = -1 Then Debug.Print fDialog.SelectedItems (1) 'The full path to the file selected by the user End If. 1.

I had a similar issue on Mac. I had to change the FileDialog to use SWT.SAVE rather than SWT.OPEN and it worked. That might or might not be a reasonable solution depending on your use case

OpenFileDialog In C#, Unlike other Windows Forms controls, an OpenFileDialog does not have the directory to be displayed when the open file dialog appears first time. The FileNames property represents all the files selected in the selection. – Searching for the file names or by date last saved does not list the files. – The files seem not to be in the recycle bin (and I don't think they have been deleted). – If I look under the 'properties' of the parent folder, the total number of files and folders suggest that the files still exist but are not visible.

VB.Net - SaveFileDialog Control, Sr.No. Property & Description. 1. AddExtension. Gets or sets a value Gets or sets a string containing the file name selected in the file dialog box. Gets or sets the current file name filter string, which determines the choices that appear in the  If you specify a file name that does not exist in the initial folder, the dialog box contains no files. The type of file that you specify in the InitialFileName property overrides the file filter settings. If you specify an invalid path, the last-used path is used. A message warns users when an invalid path is used.

RadSaveFileDialog| File Dialogs, Showing the dialog. To show You can use FileName to get the name of the selected file. RadSaveFileDialog saveFileDialog = new RadSaveFileDialog();   If you specify a file that exists in the initial folder, then only that file will appear in the dialog box. If you specify a file name that doesn't exist in the initial folder, then the dialog box will contain no files. The type of file that you specify in the InitialFileName property will override the file filter settings.

OpenFileDialog not showing correctly on .ShowDialog(), crashes, in debug. For showing the openfiledialog I use this code: ShowDialog() strfilename = OpenFileDialog1.FileName MsgBox(strfilename) End Sub Network show up fine. If you click on the network group in the file picker when uploading a file to a email message in outlook.com nothing paints in the file list pane. In the file picker in IE111 I can use one of my "favorites" that has a network path in it and then traverse back up the file system tree to where I need but its tedious.

Comments
  • Does the given filename exist?
  • Yes, the filename exists
  • See my updated question, I've tried with SetFilterPath with the same result
  • setFilterPath is the path of a directory
  • Nice catch but it doesn't work either with this : dialog.setFilterPath("/home/frederic/Documents");