Mi servirebbe risolvere questo problema...voglio elencare in una listbox i file contenuti in una directory.
Ho provato questo ma mi da già sbagliato il codice e non so come risolvere.
codice:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If FolderBrowserDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            TextBox1.Text = FolderBrowserDialog1.SelectedPath
            Timer1.Start()
        End If
    End Sub
    
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Timer1.Stop()
        Dim cartella As New IO.DirectoryInfo(TextBox1.Text)
        Dim file As IO.FileInfo
        Dim file_nella_cartella As IO.FileInfo
        file = cartella.GetFiles("*.txt")
        For Each file_nella_cartella In file
            ListBox1.Items.Add(file_nella_cartella.Name)
        Next
        Dim nome As String = file_nella_cartella.Name.ToString.Replace(".txt", "")
        ListBox1.Items.Add(nome)
    End Sub
potete aiutarmi??