private void button2_Click(object sender, System.EventArgs e)
{
if (CheckIfFileIsBeingUsed(@"D:1.doc") == true)
{
MessageBox.Show("yes");
}
else
{
MessageBox.Show("no");
}
}
public bool CheckIfFileIsBeingUsed(string fileName)
{
try
{
File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.None);
}
catch (Exception exp)
{
return true;
}
return false;
}
0.00 (0%) 0 votes









