VB.NETに指定ファイルが存在の判定
書式
Public Shared Function Exists (path As String) As Boolean
指定したファイルが存在するかどうかを確認します。
使用例
Imports System.IO
Module Module1
Sub Main()
'ファイル文字列の宣言
Dim srcFile As String = "C:\\data\\test_2022oly.doc"
If File.Exists(srcFile) Then
Console.WriteLine("ファイルが存在します")
End If
Console.ReadKey()
End Sub
End Module
Imports System.IO
Module Module1
Sub Main()
'ファイル文字列の宣言
Dim srcFile As String = "C:\\data\\test_2022oly.doc"
If File.Exists(srcFile) Then
Console.WriteLine("ファイルが存在します")
End If
Console.ReadKey()
End Sub
End Module
Imports System.IO Module Module1 Sub Main() 'ファイル文字列の宣言 Dim srcFile As String = "C:\\data\\test_2022oly.doc" If File.Exists(srcFile) Then Console.WriteLine("ファイルが存在します") End If Console.ReadKey() End Sub End Module