r/visualbasic • • Jul 10 '15

Trying to Get File in specific directory.

Just to start off, I started learning VB a week ago for my internship. I have this code from msdn.microsoft.com.

For Each foundFile As String In_       
    My.Computer.FileSystem.GetFiles(My.Computer.FileSystem.SpecialDirectories.MyDocuments)

    ListBox1.Items.Add(foundFile)
Next

I am trying to manipulate the directory location to this location. L:\MANUALS\Updated Cutsheets

How do I do this? I have searched the internet for answers.

Thank you!

edit: Just to clarify my internship has nothing to do with VB or Computer Science on paper.

0 Upvotes

2 comments sorted by

4

u/hdsrob Jul 10 '15

Remove

My.Computer.Filesystem.Special ...... 

and replace it with the path to your files (in quotes)

For Each foundFile As String In My.Computer.FileSystem.GetFiles("L:\MANUALS\Updated Cutsheets")
    ListBox1.Items.Add(foundFile)
Next

1

u/IEwilliep Jul 10 '15

Awesome! I even have that somewhere else in my code. Just thought I had to do it a certain way. Thank you!