When I change:
Dim myFiles() as String = System.IO.Directory.GetFiles(txtSrc.Text)
to:
Dim myFiles() As String
Try
myFiles = System.IO.Directory.GetFiles(txtSrc.Text)
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
it works! Without the try block...
Hi Rick,
The thing is, your little example (above) works beautifully, even when I remove the Imports statement and change all the calls to System.IO.call and get the path from a textbox.
It's my own application... When I use the textbox in any way in the call to GetFiles, VBE does not even get...
Thanks Rick, that helped. It now does not flag my old code and also accepts the System.IO.Directory.GetFiles.
But now I get another problem. When the parameter I pass to the routine (SourcePath) is a textbox (txtSrc.Text) VBE bombs out completely, it even generates an error report and sends it...
This code used to work unitl I added the Imports statement:
strFile = FileSystem.Dir(strSearch, intAttr)
...
strFile = FileSystem.Dir()
...
FileSystem.FileClose(1)
...
FileSystem.FileOpen(1, "D:\VB\" & UndoLog, OpenMode.Output, OpenAccess.Write)
...
Thanks Rick, works like a charm.
Trouble is now that, when I add the statement to my project, VBE starts complaining about my usage of Filesystem.Dir, .FileOpen, .FileClose, GetAttr, .Print, .Rename ...
What's the scoop here?
Rien.
When I try to use the example from ThatRickGuy I get an error on the line
Dim Files() As String = Directory.GetFiles(SourcePath)
VBE underlines Directory and tells me "Name 'Directory' is not declared"
What must I add to get this name declared?
Rien.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.