VB.NET
VB.NET copied to clipboard
Item is not a member of EventArgs.
I am getting an error. Is there anything wrong?
Public Class Form1
Dim path As String
Dim nextpath As String
Private Sub ListView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListView1.ItemSelectionChanged
nextpath = path + "\" + e.Item.Text //This is an error.
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
On Error Resume Next
path = "C:\"
For Each i In My.Computer.FileSystem.GetDirectories(path)
ListView1.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 1)
Next
For Each i In My.Computer.FileSystem.GetFiles(path)
ListView1.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 2)
Next
End Sub
Private Sub Form1_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles Me.MouseDoubleClick
On Error Resume Next
path = nextpath
If (My.Computer.FileSystem.DirectoryExists(nextpath)) Then
For Each i In My.Computer.FileSystem.GetDirectories(path)
ListView1.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 1)
Next
For Each i In My.Computer.FileSystem.GetFiles(path)
ListView1.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 2)
Next
Else
MsgBox(path, " Could not be found.")
End If
End Sub
End Class