.NET C#,VB.NET,VC.NET

■ファイルが存在するか調べる

System.IO.File.Exists()関数を使います。
指定ファイルが存在するか否かを調べ
結果の真偽値を得ます。
System.IO.File.Exists()関数を利用します。

C#
if ( System.IO.File.Exists(@"c:\HP\index.html") )
    MessageBox.Show( "あったよママン!" );
else
    MessageBox.Show( "ないよぉ orz" );
VB.NET
If System.IO.File.Exists("c:\HP\index.html") Then
    MessageBox.Show("あったよママン!")
Else
    MessageBox.Show("ないよぉ orz")
End If
VC.NET
if ( System::IO::File::Exists("c:\\HP\\index.html") )
    MessageBox::Show( "あったよママン!" );
else
    MessageBox::Show( "ないよぉ orz" );

トップ  > .NET C#,VB.NET,VC.NET
Copyright (C) 2005.09 〜 By Shougo Suzaki

SEO [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送