I would like to point new users to the proper directory to where the file type may be found. However, I don't want to hamper the efficiency of experienced users, as there are more specific sub folders that they may wish to remain in throughout multiple file openings.
I found some context for openfileDialog for c++ here: Initial directory is not working
However I am interested in a VB solution. Here is Microsoft's documentation: https://msdn.microsoft.com/en-us/library/system.windows.forms.filedialog.initialdirectory(v=vs.110).aspx
in which they state
The InitialDirectory property is typically set using one of the following sources: A path that was previously used in the program, perhaps retained from the last directory or file operation.
Here is my code:
true
How can I determine if a user would automatically be sent to this directory or a subdirectory in the tree if getting InitialDirectory is unreliable?
答案 0 :(得分:0)
我保存了最近打开的文件夹,并根据用户是否希望使用其他路径来重定向文件路径:
If _lastOpenFolder = "" Then
ImportDialog.InitialDirectory = "Direct Access\Shell\Customer Invoices\"
Else
ImportDialog.InitialDirectory = _lastOpenFolder
End If
If ImportDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
_lastOpenFolder = ImportDialog.FileName.Substring(0, ImportDialog.FileName.LastIndexOf("\"))
_lastOpenFolder = _lastOpenFolder.Substring(0, _lastOpenFolder.LastIndexOf("\"))
End If