Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15729

VS 2019 [RESOLVED] View files in folder based on button

$
0
0
Hey all pretty new at this. Situation I am in. I can already bring up list of files in a director. Issues I am trying to figure out is.

Form 1

Button 1 - folder1
Button 2 - folder2
Button 3 - folder3

When a button is pushed then
Form2.Show() is done

form2 I have

Code:

Dim directory = "c:\dir\"  (i need folder# to insert after the dir\ but not sure how to send it.
        Dim files() As System.IO.FileInfo
        Dim dirinfo As New System.IO.DirectoryInfo(directory)
        files = dirinfo.GetFiles("*", IO.SearchOption.AllDirectories)
        For Each File In files
            ListBox1.Items.Add(File)
        Next

So when somebody hit button 1 - 3 it will display whatever files are in that directory in the list box.

Viewing all articles
Browse latest Browse all 15729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>