Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2012 Exception when file not found - doesn't work.

$
0
0
I am trying to get an error message to show when a file isn't found, but it is just skipping to the next file listed in the datagrid. I found some examples of code using this claiming it works as intended, but I can't seem to get it. I would appreciate some ideas.


Code:

For Each row As DataGridViewRow In DataGridView1.Rows
            If Not row.IsNewRow Then

                Try

                    For Each FoundFile As String In My.Computer.FileSystem.GetFiles("C:\Test", FileIO.SearchOption.SearchAllSubDirectories, FileName & "*") 'Takes FileName and searches a directory and child directories

                      File.Copy(FoundFile, Destination + FileCounter, True)  'For testing only.

                    Next
                Catch ex As Exception
                    MsgBox(ex.Message)
                End Try
            End If
        Next


Viewing all articles
Browse latest Browse all 27554

Trending Articles



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