As all of you know that we have feature called “File/Folder Path” on Form designer, it pops out the dialog which looks like below.
Basically no one likes this Ui as its very hard to navigate to your desired folder and select it.
We prefer the below one which is more user friendly
Is there any possibility to get this feature (second one) on form in other way ? or is there any workaround to get this feature (using method or else)
Please suggest me on this.
a simple implementation will be
Dim OpenFileDlg as new OpenFileDialog
OpenFileDlg.FileName = "" ' Default file name
OpenFileDlg.DefaultExt = ".txt" ' Default file extension
OpenFileDlg.Filter = "Text Files (*.txt)|*.TXT"
OpenFileDlg.Multiselect = True
OpenFileDlg.RestoreDirectory = True
Dim result As Boolean = OpenFileDlg.ShowDialog()
I found it through this interesting link.
vb.net - Open *.txt with file selector from vb console application - Stack Overflow
thanks for reply, sorry but it didnt work and moreover its for file selection dialog not folder selection dialog
Found something even simpler Select file/Browse for file
Hi, I have already voted, thanks a lot for raising this.
Thanks, but it wont work.
This is for selecting file, in my scenario I need to navigate to a folder and select that folder.
Anyways I have created a C# code to achieve this using UiPath.
Please share your code. It could help others, including me
sure, first add references to Microsoft.Office.Core (Microsoft Office 14.0 Object Library) and Microsoft.Office.Interop.Excel (Microsoft Excel 14.0 Object Library).
Also you need to incorporate the packages as well.
Ans then try the below code afterwards, I have to follow some tricks (using MS excel application) to open the dialog though the code is not opening the excel but the folder selection window.
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Core.FileDialog fileDialog = app.get_FileDialog(Microsoft.Office.Core.MsoFileDialogType.msoFileDialogFolderPicker);
fileDialog.InitialFileName = "c:\\Temp\\"; //something you want
int nres = fileDialog.Show();
if (nres == -1)
Microsoft.Office.Core.FileDialogSelectedItems selectedItems = fileDialog.SelectedItems;
string selectedFolders = selectedItems.Cast<string>().ToArray();
if (selectedFolders.Length > 0)
string selectedFolder = selectedFolders;
Also create an argument and incorporate it in the invoke code.
Working code for me vb.net
(Studio 21.10.4, System.Activities 22.10.4, Windows-Legacy project)
Invoke code activity:
Dim xl As New Microsoft.Office.Interop.Excel.ApplicationClass
Dim fd As Microsoft.Office.Core.FileDialog
fd = xl.FileDialog(MsoFileDialogType.msoFileDialogFolderPicker)
fd.Title="Select folder you want to process"
result = fd.SelectedItems(0).ToString
One argument out: result (as String)
I had to import those (as mentioned before):