既にファイルが存在しているかどうか確認する方法を記載します。
File.Exists メソッドを使用する方法
Dim sFilePath As String = "C:\work\myfile.txt"
If System.IO.File.Exists(sFilePath) Then
MessageBox.Show("存在します")
Else
MessageBox.Show("存在しません")
End If
FileSystem.FileExists メソッドを使用する方法
Dim sFilePath As String = "C:\work\myfile.txt"
If My.Computer.FileSystem.FileExists(sFilePath) Then
MessageBox.Show("存在します")
Else
MessageBox.Show("存在しません")
End If
FileInfo クラスを使用する方法
Dim sFilePath As String = "C:\work\myfile.txt"
Dim finfo As New System.IO.FileInfo(sFilePath)
If finfo.Exists() Then
MessageBox.Show("存在します")
Else
MessageBox.Show("存在しません")
End If
※フォルダの存在は、上記のものではチェックできません。フォルダは Directory.Exists 等を使用します。