if (!File.Exists(文件名称) == true)
{
MessageBox.Show("存在此文件!");
}
else
{
FileStream myFs = new FileStream(tablename, FileMode.Create);
StreamWriter mySw = new StreamWriter(myFs);
mySw.Write(文件内容);
mySw.Close();
myFs.Close();
MessageBox.Show("写入成功");
}