Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
For Each fileName As String In IO.Directory.GetFiles("\\fs1gbn1fs005\uu-it-ops-service-desk-only$\Software")
' ImageList1.Images.Add(Icon.ExtractAssociatedIcon(fileName))
ListView1.Items.Add(IO.Path.GetFileName(fileName), ImageList1.Images.Count - 1)
Next
End Sub
THIS WORKS... but when clicking on the item in LV..Private Sub ListView1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDoubleClick
For Each file As ListViewItem In ListView1.Items
Dim filePath As String = file.SubItems(0).Text & "\" & file.Text
If file.Selected = True Then
Process.Start(filePath)
End If
Next
End Sub
This bit does work... & i know its for launching the app... I want to open the dir. Dim filePath As String = "C:\Users\bob\Documents\New Folder"
Dim folderPath As String = System.IO.Path.GetDirectoryName(filePath)
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
For Each fileName As String In IO.Directory.GetFiles("C:\Users\bob\Documents\New Folder")
ListView1.Items.Add(IO.Path.GetFileName(fileName))
Next
Label1.Text = folderPath
End Sub
Private Sub ListView1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListView1.SelectedIndexChanged
Process.Start("explorer.exe", filePath)
Label1.Text = folderPath
End Sub
End Class
It loads files from specified DIR to LV,,, if I click 1 item, it opens 2 explorer windows.
Private Sub ListView1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListView1.SelectedIndexChanged
Dim filePath As String = "C:\Users\bob\Documents\New Folder"
Dim folderPath As String = System.IO.Path.GetDirectoryName(filePath)
Process.Start(folderPath)
End Sub
It opens folder in explorer, but only as far as Users dir Dim filePath As String = "C:\Users\bob\Documents\Battlefield 2"
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ListView1.Items.Add(IO.Path.GetFileName(filePath))
End Sub
Private Sub ListView1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListView1.SelectedIndexChanged
Process.Start(filePath)
End Sub
It lists 1 folder "Battlefield 2", but I know there are 3 folders in here... can i just change it to show folders in 'Battlefield 2' folder....
Private Sub ListView1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDoubleClick
Process.Start(filePath)
End Sub
When i click selected item (dir name)... is it possible to open the selected dir name from the LV item... rather then filePath on any selected item? Private Sub ListView1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDoubleClick
Dim lvi As ListViewItem = ListView1.GetItemAt(e.X, e.Y)
If Not IsNothing(lvi) Then
Dim folder As String = lvi.Text
Dim subFolder As String = System.IO.Path.Combine(filePath, folder)
Process.Start(subFolder)
End If
End Sub
Open in new window