AnsweredAssumed Answered

Hi I’m having trouble getting the selected file name from the vault with my vb.net program I’m writing ,here is a code that works but it does not work in the vault .  please help

Question asked by Fourie Steyn on Jan 24, 2018
Latest reply on Jan 26, 2018 by Jacob Corder

Not Working in Solidworks EPDM Vault

not working.PNG

Working in normal windows folders

working.PNG

Imports Shell32

Imports SHDocVw

Imports System.IO

 

Public Class Form1

 

Private Function GetExplorerSelectedFiles() As String()

 

        Dim ExplorerFiles As New List(Of String)

 

        Dim exShell As New Shell

 

        For Each window As ShellBrowserWindow In DirectCast(exShell.Windows, IShellWindows)

        

            If TryCast(window.Document, IShellFolderViewDual) IsNot Nothing Then

                    For Each fi As FolderItem In DirectCast(window.Document, IShellFolderViewDual).SelectedItems

                        ExplorerFiles.Add(fi.Name)

                    Next

 

                ElseIf TryCast(window.Document, ShellFolderView) IsNot Nothing Then

                    For Each fi As FolderItem In DirectCast(window.Document, ShellFolderView).SelectedItems

                        ExplorerFiles.Add(fi.Name)

                    Next

 

                End If

            Next

 

        Return ExplorerFiles.ToArray

    End Function

 

Private Sub btntest_Click(sender As Object, e As EventArgs) Handles btntest.Click

 

        Dim files = GetExplorerSelectedFiles()

        Dim file As String = String.Join(".", files)

        Label1.Text = file

 

End Sub

End Class

Outcomes